Lower Bounds & Adversary Arguments

the comparison model

Imagine sorting a deck of cards while wearing a blindfold, where the only thing you are allowed to do is hand two cards to a referee and ask 'which is larger?'. You never look at the actual numbers; you only learn the outcome of yes/no comparisons. Many famous algorithms — insertion sort, merge sort, quicksort, binary search, heaps — work exactly this way: they touch the data only through comparisons. The comparison model is the rulebook for this restricted style of computation.

Precisely, in the comparison model the only operation that can inspect the input values is a comparison between two elements, returning whether a < b, a = b, or a > b. The algorithm may also move elements around freely, but it cannot do arithmetic on the keys, hash them, or read their bits — it gains information about the input ONLY from comparison outcomes. This restriction is what makes clean lower bounds possible: since every step that learns anything is a comparison, you can count comparisons as a proxy for total work, and an algorithm that must distinguish among many possible answers must ask enough yes/no questions to tell them apart.

The point of choosing this model is honesty about what is being proven. The famous Omega(n log n) sorting bound and Omega(log n) sorted-search bound are theorems ABOUT this model — they say no comparison-based algorithm can do better. They do not forbid faster methods that step outside the model: counting sort and radix sort beat n log n precisely because they peek at the keys' values or digits rather than only comparing. So the comparison model is not a law of nature; it is a fair and common arena, chosen because most general-purpose sorting and searching really does live inside it, and because it yields lower bounds that match the best comparison algorithms exactly.

Binary search lives in the comparison model: at each step it asks 'is the target less than A[mid]?' and uses only that yes/no answer to discard half the array. It never uses the numeric gap between the target and A[mid]. That is why its O(log n) is a comparison-model statement.

In the comparison model the only window into the data is 'which is bigger?'.

The comparison model forbids using a key's actual VALUE (its bits, its digits), only its order relative to others. Counting and radix sort are not in this model and so legitimately beat Omega(n log n) — that is not a contradiction, it is a change of rules.

Also called
comparison-based computationcomparison-only model比較式計算模型