Module 12 · sort, Comparators and Lambdas: Tell the Algorithm What You Mean
When to Sort, and When a set, a priority_queue or Counting Does It Better
Free with an accountReading
Kenji sorts everything. He sorts a million marks to print them in order, and he sorts a million scores to find the best ten. When a new score arrives, he sorts all of them again. Every program works. Amara asks him one question: what did the job need? This lesson is her answer, with a chart, a flowchart and one lab of nine timed jobs.
Checking what this lesson needs for you…
What is inside When to Sort, and When a set, a priority_queue or Counting Does It Better
- Five questions before you sort
- The comparison chart
- A million values, measured
- The decision flowchart
- When not to sort
- The honest default