Data structure: sort and search effectively
- by Jiten Shah
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.