Learn C++ STL

Lesson 3 of 9 · priority_queue: The Biggest One Comes Out First

Module 7 · priority_queue: The Biggest One Comes Out First

Full Programs: From the Top Three Scores to a Shortest Route

Free with an accountReading

You have met every program in this lesson already, just without its name. Think of a leaderboard, a merged chat history, a phone's reminders, a class's middle mark or a map app's route. Each is a job a priority_queue does well. Six programs follow, each a little bigger, with a "new thing" line above each.

Checking what this lesson needs for you…

What is inside Full Programs: From the Top Three Scores to a Shortest Route

  1. Program 1: the three highest scores of a match
  2. Program 2: the k largest of a long stream
  3. Program 3: three servers' logs, merged in time order
  4. Program 4: Maria's maintenance scheduleIntermediate
  5. Program 5: the running median with two heapsIntermediate
  6. Program 6: the fastest route between six townsIntermediate