Module 13 · binary_search, lower_bound, upper_bound and equal_range
Full Programs: From a Price Check to Binary Search on the Answer
Free with an accountReading
Six jobs follow, and all of them have the same shape: sort once, then answer many questions. A phone shop counts what a budget buys. A library shelf stays in order while books come back. A bakery finds the next van, and a school keeps its phone numbers. Then comes the idea contests love most, binary search on an answer that is not stored anywhere. The last program times the sort against a plain scan, to show when sorting pays. Read the "new thing" line above each program first.
Checking what this lesson needs for you…
What is inside Full Programs: From a Price Check to Binary Search on the Answer
- Program 1: how many phones fit a budget
- Program 2: a shelf that stays sorted
- Program 3: the first van at or after a time
- Program 4: a phone directory in a sorted vectorIntermediate
- Program 5: binary search on the answerIntermediate
- Program 6: does the sort pay for itself?Intermediate