Re: Storing large number of values in 2D array



dcorbit@xxxxxxxxx writes:
Lew Pitcher wrote:
rajus wrote:
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?

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.

Suppose each (x,y) coordinate consists of a pair of integers, each of
which can be in the range 0..999999. If the OP wants to store
information about each point in the corresponding element of a 2D
array, the array would have to have one trillion (10**12) elements.
Some sort of sparse array representation is just about mandatory.

I think the OP wants to store information about a point, and use the
coordinates of the point to retrieve it later. I might consider using
a hash table, hashing the (x,y) coordinate pair to obtain the
retrieval key.

But we need more information from the OP. How are the (x,y)
coordinates represented (int, double, whatever)? What are the
possible ranges? What information to you need for each point? How
important is fast access to each point?

--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.



Relevant Pages

  • Re: Newbie help
    ... think I can probably get what I need using SQL Server (the ... > To efficiently store and retrieve data for your needs, ... You only store changed values (as ...
    (microsoft.public.sqlserver.programming)
  • Re: DOCX FILE CORRUPTED WHEN RETRIEVED FROM SQL2005
    ... I am facing the same problem and would appreciate your reply on the same as it has become a show stopper for me now. ... My Code is given below to retrieve the docx content from SQL 2005 whose data type is image. ... Here is the code where i insert the file into database. ... when I store these files to the server, using the code below and similar ...
    (microsoft.public.office.developer.vba)
  • Re: Simulink store/retrieve values during simulation
    ... Is there really no way that you can store and retrieve data values during a simulink simulation like you can do with a written loop in an standard m-file? ... or in the signal processing blockset look at the buffer or delay line blocks. ...
    (comp.soft-sys.matlab)
  • C#, ADO.NET and MS-SQL
    ... 1.Enter/Select Ledger ... retrieve matching Ledgers. ... Store all Supplier details - not practical? ...
    (microsoft.public.dotnet.languages.csharp)