Skip to main content
  1. /classes/
  2. Classes, Spring 2025/
  3. CS 2370 Spring 2025: Course Site/

cs2370 Notes: 16 Sorting Fast

·56 words·1 min·

Last time:

  • Insertion sort and in-place selection sort.

First, let’s get a list of random numbers.

from random import randint

def random_list(nn: int) -> list[int]:
    ys = []
    for ii in range(0, nn):
        ys.append(randint(0, 99))
    return ys

This time:

  • Merge sort, following the pattern.
  • In-place quicksort with swaps.

Note how both of these solutions are recursive.

Nat Tuck
Author
Nat Tuck