Meeting 40: STL Containers and Algoprithms

TIP: prefer to use containers and algorithms from the standard library rather than hand-coded data structures and algorithms. Learn what is in the standard library and how to use it.

This semester we have seen how to implement data structures and common algorithms for sorting and searching. However, the C++ standard library provides implementations of these that are efficient and well tested, so you should prefer to use them over hand-coded approaches whenever feasible. This extends beyond complex algorithms, to what might appear as simple loops.

Aside: This might cause you some annoyance, why did we ask you to write code in 2574 that already exists? The reasons are that: one, it helped you understand which data structure and algorithm to use and under what tradeoffs, two, it was good experience, and three, in some cases, often in embedded programming, the C++ standard library is not a viable option.