Data structure: sort and search effectively
Posted
by
Jiten Shah
on Programmers
See other posts from Programmers
or by Jiten Shah
Published on 2012-09-18T12:22:52Z
Indexed on
2012/09/18
15:53 UTC
Read the original article
Hit count: 480
I need to have a data structure with say 4 keys . I can sort on any of these keys. What data structure can I opt for? Sorting time should be very little.
I thought of a tree, but it will be only help searching on one key. For other keys I'll have to remake the tree on that particular key and then find it. Is there any data structure that can take care of all 4 keys at the same time?
these 4 fields are of total 12 bytes and total size for each record - 40 bytes.. have memory constraints too...
operations are : insertion, deletion, sorting on different keys.
© Programmers or respective owner