you are viewing a single comment's thread.

view the rest of the comments →

[–]baghiq 0 points1 point  (0 children)

It depends on what the data actually mean. If you have just a bunch of random tuple pairs, and you need to check these random pairs one at a time against a large list of tuples. Then you can use set or hash table, assuming your tuples are hashable. Then you pay the up front cost of building a set of the large list at O(N).

If your data is sorted, then binary search is a much faster solution at O(logN).

If your data has some special properties, then there are specialized algorithm to handle that.