First Graders Use Optimized Insertion Sort

Every other Monday morning, I take Lauren (my first grader) to school and work in her classroom for about an hour. One of the things we do before the other students get there is to assemble homework folders for the week. Lauren’s job is to sort the folders (they are numbered) for the 20 students in her class, and I put the homework packets in the folders. You know you’re a geek when you watch your first grader sort things to see what algorithm she uses.

Turns out she uses a slightly optimized insertion sort — she scans for the smallest item (#1) and moves it to the front, then scans left-to-right looking for #2, etc. Sometimes her scan is optimized because she remembers #5 is near the end, and can jump near it instead of doing a full scan. Its not the fastest algorithm, but it works just fine for 20 items. I think I’ll wait until 2nd grade to teach her to quicksort 🙂

Advertisements