views:

57

answers:

1

What is the best search algo that has least worst case of execution time and is memory efficient. I'm looking for a data structure that can store lots of data within least memory possible and also is quickest to search for any item. This is for a scenario where i have few entries of form say A(name,value) pairs. and there are other entriesm, say B (name,value, relational operator). For every A, I need to search find its matching entry in B, so its basically a search operation. Amount of data is humongous but i shoud be able to meet the memory requirements which is very less.

+1  A: 

It is difficult to give an answer based on the generic description you provided. The answer may be different based on your actual user case. However, In general case assuming your data is already in sorted order I would suggest to use binary search. The complexity is O(log n) and memory required is almost same as that of data itself.

Gopi
That sounds accurate.
Matt Williamson