main page  —  COMP 526 Efficient Algorithms

Unit 3: Efficient Sorting – The Power of Divide & Conquer

This unit covers

  • mergesort and quicksort
  • counting sort
  • comparions lower bound for sorting
  • adaptive sorting
  • further divide & conquer algorithms

Learning outcomes

  1. Know principles and implementation of mergesort and quicksort.
  2. Know properties and performance characteristics of mergesort and quicksort.
  3. Know the comparison model and understand the corresponding lower bound.
  4. Understand counting sort and how it circumvents the comparison lower bound.
  5. Know ways how to exploit presorted inputs.

Material

Part I – The Basics

Part II – Exploiting presortedness

  • Video 3-5 · transcript (2023-10-19, 34:22): §3.5 Adaptive sorting & Peeksort
    Chapters3:41 Simple sorting optimizations
    6:44 Analyzing performance metrics
    13:00 Bottom-up merge sort
    17:15 Limitations of current approaches
    22:10 Optimal merging strategies
    27:02 Peak sort and conclusion
  • Video 3-6 · transcript (2023-10-19, 15:06): §3.6 Python’s list sort & Powersort
    Chapters2:33 How Timsort functions
    5:50 Limitations of Timsort
    7:10 Introduction to Powersort
    10:20 Balanced tree intuition
    14:19 Conclusion of Powersort

Part III – Divide & conquer beyond sorting

  • Video 3-7 · transcript (2023-10-20, 32:50): §3.7 Order statistics, quickselect, median of medians
    Chapters3:31 Selection by rank problem
    8:36 Quick select algorithm
    14:01 Worst-case performance issues
    23:20 Median of medians algorithm
  • Video 3-8 · transcript (2023-10-20, 15:04): §3.8 Further divide & conquer algorithms
    Chapters0:28 The majority problem
    2:31 Divide and conquer solution
    7:21 Linear time voting algorithm
    10:41 Closest pair of points

Further reading and sources

More elementary sorting methods are described in detail in Algorithms 4th ed.

The exposition of adaptive sorting is my own and based on several sources:

The presentation of quickselect and the median-of-medians algorithm is inspired by material prepared for the module

The other material of Part III is based on


Unit 2  ⋅  Syllabus  ⋅  Unit 4