Can anyone offer an elegant solution for a data structure that maintains
sorted order as well as access to data for a (primary) key?

Is everyone thinking too hard or am I not thinking hard enough?


If you have a database and you need to search it on an alternate key, you either linear search on the alternate key or define the alternate key formally in the database as an alternate key. Defining an alternate key is just setting up a reverse-lookup index table. (Conceptually.)

So, if you don't want to linear search, and you don't want to build a reverse-lookup hash, your usual option would be to build something that works as an alternative way to reverse-lookup, say a binary tree or a trie or even a linear sorted array to do a binary search on. Right?

Deciding between the various alternatives is just weighing the cost of each approach, and deciding which cost you can afford best. Right?

I guess I just don't understand the thread.

reiisi

Reply via email to