January 31st, 2012, 12:24 AM
Need the best way/algorithm to use for following condition?
Lets take example first
I have a list of users having different values of A,B,C.
user A B C
User 1. test1 A1 B1 C3
User 2 test2 A1 B1 C1
User 3 test3 A2 B3 C3
A contains element in range of (1-400)
B contains element in range of (1-200)
C contains element in range of (1-300)
So i need to develop a algorithm that gives me the result in very quick time whenever i query for those variable A,B,C
ex. give me users whose A=A1, B=B1, C=C3 [Answer should be test1]
i can also say give me users whose A=A1[Answer should be test1,test2]
February 24th, 2012, 10:54 PM
Build three lists of value and name-list pairs from the original data source. Then for each criteria in the query, find the union of the specified lists. So for A=2, you just look in the A list for value=2 and return the list of names (test3) and for A=1, B=1 take the union of the A=1 result and the B=1 result (test1,test2).
I no longer wish to be associated with this site.