Why does pre-sorting data pay off in practice?
Asorting always reduces total memory used by half
Blater searches and order-stat queries get much faster
Csorting eliminates the need for any hash table
Dthe SQL standard mandates sorted storage
Answer & Solution
Correct answer: B. later searches and order-stat queries get much faster
Sorting is the cost paid up-front so every later lookup, dedup pass, or median query can run on an indexable array. Binary search in O(log n) instead of O(n) linear scan is the canonical win. Memory isn't reduced by sorting; hash tables and sorted arrays are different tools; the SQL standard does not mandate sorted storage.
Related questions
An NP-hard problem differs from an NP-complete one because NP-hard problemsThe first problem proved to be NP-complete wasA problem X is NP-complete if and only ifWhy does theoretical computer science draw the line at 'polynomial-time' for tractability?Which set inclusion is established (i.e., proven, not open)?The class NP is the set of decision problems for whichFloyd-Warshall detects the presence of a negative cycle byTopological sort is well-defined for