Unit V: Sorting and searching
Lecture notes
- Notes for class V.1: Sorting
- There were no notes for class V.2.
- Notes for class V.3: Sorting algorithms
- Notes for class V.4: Searching
Sample Programs
- Here we have sort.cpp,
which includes code for the various sorting algorithms discussed in
class V.1 and class V.3.
- For class V.w lots-of-numbers.txt is a
largish list of numbers to test sorting and searching algorithms with.
- From class V.4 we have search.cpp, which has code for the
search algorithms we discussed,
- Here is ga.cpp, which is the code
for the genetic algorithm described in the notes.
- Here is evader.cpp, which you
will need for homework V.
Lab exercises
Reading
The switch control structure is in
Chapter 9, of the textbook, pages 228 to 229.
Sorting and searching aren't really covered in much detail in the
textbook, but insertion sort pops up on pages 149-153.
As ever, the material is a little different from what we looked at in
class, but all of it is relevant. Don't skip stuff just because
I didn't mention it.