R
rajus
I want to store the (x,y) coordinates of about 10,000 points in a 2D
array.How can I store them and retrieve them later?
array.How can I store them and retrieve them later?
rajus said:I want to store the (x,y) coordinates of about 10,000 points in a 2D
array.How can I store them and retrieve them later?
You have 10 000 x 2 points i.e. 20 000 points to store.rajus said:I want to store the (x,y) coordinates of about 10,000 points in a 2D
array.How can I store them and retrieve them later?
You have 10 000 x 2 points i.e. 20 000 points to store.
To minimize space you could use 12 bits (coordinates up
to 4096x4096) and store 5 points per 64 bits, making it
around 32 000 bytes for the 2D array.
rajus said:I want to store the (x,y) coordinates of about 10,000 points in a 2D
array.How can I store them and retrieve them later?
Lew said:I'm afraid that your question doesn't relate specifically to the use of
the C langage, and is off topic in this forum. You might try one of the
comp.programming groups where they discuss algorithms and data
structures.
But, before you go, why don't you think about a sparse matrix
implementation?
Something like
struct { long x; long y; } coord[10000];
rajus said:I want to store the (x,y) coordinates of about 10,000 points in a 2D
array.How can I store them and retrieve them later?
With 10,000 points, a sparse array implementation is a total waste of
time and energy.
Even with doubles that's {typically} 16*10,000 = 160,000 bytes.
Considering 1 GB of PC3200 DDR2 ECC ram at $112:
http://www.ramseeker.com/pc/index.php
that's about 1/2 cent worth of memory. Hardly worth worrying about
sparse implementations.
If this isn't a C question, then I don't know what one is.
Lew said:I'm afraid that your question doesn't relate specifically to the use of
the C langage, and is off topic in this forum. You might try one of the
comp.programming groups where they discuss algorithms and data
structures.
If this isn't a C question, then I don't know what one is.
But, before you go, why don't you think about a sparse matrix
implementation?
Something like
struct { long x; long y; } coord[10000];
With 10,000 points, a sparse array implementation is a total waste of
time and energy.
Even with doubles that's {typically} 16*10,000 = 160,000 bytes.
rajus said:I want to store the (x,y) coordinates of about 10,000 points in a 2D
array.How can I store them and retrieve them later?
Al said:Of course, the extra code required to do this would probably make up
for the saved space. I like Lew's suggestion, using whatever size
integer is appropriate.
Well, declare a 2D array of points. Store points in the array. Retireve them
later from the array. What exactly is the problem that makes you ask such a
trivial question?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.