<aside>
This section is part of the 5-hour LeetCode DSA Foundations course by Mukul Raina
Section 9: Sorting
Sorting appears in interviews in two distinct ways. First, interviewers ask you to explain the trade-offs between sorting algorithms: why would you choose Merge Sort over Quick Sort, or when does Counting Sort outperform both? Second, and more commonly, sorting is a preprocessing step that unlocks simpler solutions to problems that are otherwise quadratic.
You have already seen this principle in action. In Section 6, Three Sum sorted the array first so two pointers could work. In Section 8, binary search required sorted input as a precondition. Many interval problems, scheduling problems, and duplicate-detection problems become simple linear scans after a sort.
What We’ll Cover
Connection to Other Sections
Sorting is prerequisite knowledge for two pointers on unsorted input (Section 6), binary search (Section 8), and many greedy problems (Section 13) including interval scheduling. When you see a problem where sorted order would make the solution obvious, that is a sort-then-solve signal.
<aside>
Mukul Raina | youtube.com/@mukulraina | linkedin.com/in/mukulraina
</aside>
Not all sorting algorithms are equal. Each has different guarantees on time, space, stability, and worst-case behavior. Interviews rarely ask you to implement a sort from scratch, but they do ask you to explain trade-offs and choose the right one.
Algorithm Comparison