Jump to content

  • Log In with Google      Sign In   
  • Create Account


Searching Algorithm on Matrix Type Data


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Instigator   Members   -  Reputation: 149

Like
0Likes
Like

Posted 16 May 2013 - 11:18 AM

I would like to implement an efficient algorithm to search data as part of the following format.

 

|X|Y|100 character length string|

 

All columns are non-unique. Which means you can have

 

|5.5|23.4|SOME TEXT|

|10.1|12.2|SOME TEXT|

|10.1|10.1|MORE TEXT|

 

 

An example of a query would be :

 

- FindText("SOME*") /*Returns all rows with this text */

- FindX(10.1)

- FindY(10.1)

.

.

 

Will a simple array suffice or is their an algorithm more efficient I should  read about? 


Edited by Instigator, 16 May 2013 - 11:19 AM.


Sponsor:

#2 Álvaro   Crossbones+   -  Reputation: 12383

Like
0Likes
Like

Posted 16 May 2013 - 11:57 AM

You can keep the data in an array and then have auxiliary data structures to be used as indices, which would map values of a column to indexes to the main array. If you are using C++, std::unordered_multimap is a good way to do this.

 

If you are never going to remove data, this is really simple.


Edited by Álvaro, 16 May 2013 - 11:57 AM.


#3 Instigator   Members   -  Reputation: 149

Like
0Likes
Like

Posted 16 May 2013 - 08:35 PM

Cool idea! I will look into this






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS