Java Arena

Module 28

Sorting and searching

Two classic problems and the algorithms that solve them. Finding the smallest value and its index, swapping two elements, selection sort, Java's ready-made Arrays.sort and Collections.sort, linear search and binary search, and counting how much work each one does. MOOC section 7.2.

Steps

  1. Algorithms and the smallest value
  2. Swapping, and sorting by hand
  3. Selection sort in code
  4. Java's own sorting methods
  5. Linear search
  6. Binary search