Hi,
Use hashing, but with perfect hashing which does all these operations in
O(1).
Refer to Introduction to Algorithms by CLRS to learn about perfect hashing.
--
If you are using Java, you can go with LinkedHashMap.
On Sat, Jan 5, 2013 at 6:40 PM, Nishant Pandey nishant.bits.me...@gmail.com
wrote:
Give a Data structure to store Name-value pair like name-age
abc,12
xyz,34...
such than insert(name,value), value = search(name), name = nthentry(n),
no i am using C for this implementation , can you suggest me algo for this
On Tue, Jan 8, 2013 at 5:55 PM, Sachin Maheshwari
sachin.maheshw...@gmail.com wrote:
If you are using Java, you can go with LinkedHashMap.
On Sat, Jan 5, 2013 at 6:40 PM, Nishant Pandey
Give a Data structure to store Name-value pair like name-age
abc,12
xyz,34...
such than insert(name,value), value = search(name), name = nthentry(n),
delete(name); all can be perfomed in O(1).
Note:- after deletion order should be maintained.Ex.
ds,12
df,78
teu,54
etr,12
If delete(df) is called