The last lesson ended with a condition: binary search works only on sorted data. So who sorts it? Picture the result sheet of a recruitment test, with the scores in the order in which the answer scripts happened to be checked. Before anyone can search it quickly, somebody has to put it in order, and "write a program to sort these numbers" is one of the questions programming papers ask most often.
This lesson is about moving things. By the end you'll be able to swap two values in three ways and say which one breaks, and when. You'll exchange the two halves of a 32-bit integer with masks and shifts. You'll write bubble sort, selection sort and insertion sort, trace them pass by pass, count their comparisons and swaps, and give their best, average and worst cases. You'll write the code that tests a sort. And you'll finish with a short tour of the rest of the vocabulary the papers use: listing all the arrangements of a set by backtracking, BFS and DFS, greedy methods, dynamic programming and divide and conquer, and one map that sends the wording of a problem to its pattern.
We go in two parts: first swapping and the simple sorts, then the arrangements, the graph walks and the names of the strategies. Every program here was compiled and run, and the output you see is the real output. Where a program does something the C language leaves undefined, it says so.