Learn C++ STL

Lesson 3 of 9 · The Algorithms You Will Use Weekly: accumulate to nth_element

Module 14 · The Algorithms You Will Use Weekly: accumulate to nth_element

Full Programs: From a One-Line Average to the k-th Smallest

Free with an accountReading

Every week brings the same small jobs. Average a class's marks, keep a running total of steps, turn a duty rota, clean a sign-up list. List every order of a few chores, and find the middle response time of a web page. Each job is one algorithm call with a few lines around it. Six programs follow, each a little bigger than the last. The "new thing" line above each program says what it adds.

Checking what this lesson needs for you…

What is inside Full Programs: From a One-Line Average to the k-th Smallest

  1. Program 1: a one-line average
  2. Program 2: running totals of a week's steps
  3. Program 3: turning a duty rota
  4. Program 4: removing duplicates, and collapsing repeatsIntermediate
  5. Program 5: every order of four choresIntermediate
  6. Program 6: the median and the 90th percentileIntermediate