Subj : Re: searching based on 2 keys To : comp.programming From : No Such Luck Date : Thu Jun 30 2005 12:33 pm > Hello, > >Suppose I have the following table: > >key value >---- ----- > >2 foo >24 bar >12 baz > >Now I need an efficient algorithm so that I can search based on either >the key or the value. One of the solutions is to use 2 tables - but we >are heavily memory constrained and that is not a solution. Are there >any other suggestions that I can try? What are the ranges of the key? From what to what (i.e. 0 to 100000?). What is the nature of the values? Will they always be strings of 3 chars? I don't know enough about your problem to suggest a data structure in line with your memory restrictions. .