Practice free →
HomeGATE CSEcomputerscienceAlgorithms › Why does pre-sorting data pay off in practice?

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.
Solve this in the app — GATE CSE practice & 24k+ MCQs →
Related questions