/* attempt to deal with prototype, bootstrap, jquery conflicts */ /* for dropdown menus */

Jump to content

Image of the Day

Today's #ScreenshotSaturday features Face Your Fears from Turtle Roc ... #virtualrealityshop #mobilevr #vrshop https://t.co/3qhSNAVNOZ
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net's newsletters to receive the latest updates and exclusive content.


Sign up now

Searching Algorithm on Matrix Type Data

4: Adsense

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   

150
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.


#2 Álvaro   Members   

20658
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   

150
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.