Algorithms and Data Structures · Senior · Question 19 of 75

How do you sort a 200 GB file on a machine with 8 GB of RAM?

Explanation

External merge sort writes sorted runs to disk and then merges them, reading each run sequentially. The heap picks the smallest head among k runs in O(log k). Splitting by first character doesn't balance the pieces.

Further reading

Problem with a question

Algorithms and Data Structures · Senior · question 19

Test yourself

Take the Algorithms and Data Structures · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz