15-150: Principles of Functional Programming

Lecture 7: Sorting Lists

We implemented and analyzed insertion sort last time.
Today, we implemented mergesort, then analyzed its work and span.
We saw that mergesort offers a nice opportunity for parallel speedup.

At the end of lecture, we started our discussion of sorting using trees:
  We defined what it means for a tree to be sorted.
  We implemented a function to insert an element into a sorted tree while preserving sortedness.

Key Concepts

Sample Code

Some Notes on Integer Sorting using Lists

Slides from Lecture