459,292 Members | 1,354 Online
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,292 IT Pros & Developers. It's quick & easy.

# organizing elements of two sets for efficient search.

 P: n/a Hi, I am trying to do the following: I have two sets of integers(both are disjoint). Based on some criteria, I choose one integer from each set and do one computationally expensive operation using the two. Now, I do not want to do the same operation more than once on same pair of integers. So I was thinking of making up some kind of table of pairs of two integers, one from each set, and checking in this table if the operation has already been done. If yes, then I move on, and if not then I attempt it. Also, every now and then, I would want to remove all such pairs whose first element is a given or whose second element is a given value. Also if I find a new pair which is not already in the table, I would like to insert it into the table. For a bit more detail, the operation is linear program, and the set of integers identify regions in N dimensional space. So, as to be expected as N increases, the no of elements in the set could be expected to rise exponentially. Any suggestions, given this scenario, what might be best way in terms of efficiency to do it. Of course, this would make sense as long as searching through the table takes less time then solving the linear program itself.. thanks, --a. Sep 23 '05 #1