Save this video free

Selection and closest pair

Kent Quanrud · 1:13:22 · Watch on YouTube

Part of Purdue University Fundamental Algorithms (Fall 2026). See all 20 lectures and search them

These notes were made with YouTube Collector. Paste any YouTube link and get the same: a summary, chapters and a searchable transcript.

Overview

Kent Quanrud develops two divide-and-conquer algorithms: deterministic linear-time selection using the median-of-medians pivot, and an O(n log n) algorithm for the closest pair of planar points. The selection analysis contrasts useful multiplicative shrinkage with ineffective additive progress, then proves that groups of five produce a pivot leaving at most about 70% of the input; the closest-pair analysis uses a narrow strip and a packing argument to limit comparisons to a constant number per point.

Key takeaways

Chapters

0:00 Selection: Finding the Rank-K Element
0:26 Sorting and Heaps as Selection Baselines
5:23 Why Selection Needs a Carefully Chosen Pivot
10:02 An Exact-Median Oracle Would Give Linear Selection
18:48 Approximate Medians and Geometric Shrinkage
30:07 Why Removing Only a Few Extreme Values Fails
41:20 Why a Small Sample Median Can Still Be Too Slow
51:09 Median of Medians: Build a Robust Pivot from Groups of Five
55:26 Groups of Five Guarantee a 30%-70% Pivot Split
1:00:13 Closest Pair: From Quadratic Search to Divide and Conquer
1:03:19 Split Planar Points by the Median X-Coordinate
1:05:10 Use Y-Order to Bound Strip Comparisons
1:09:00 Packing Argument Limits Nearby Points
1:11:55 Closest-Pair Recurrence and O(n log n) Bound

Keep these chapters and the full searchable transcript in your own library.

Transcript excerpt

0:06 Okay, off we go then. So, today we're going to do uh two more problems. Uh one's called selection, one's called closest pair. So, uh oh, here's maybe the I guess we just sort of did this, but is there any other questions regarding the syllabus and all that? All right, on we go. Okay. So, uh, okay. So, the first problem is selection. A little bit like sorting, but not exactly. I give you a bunch of numbers and I ask you for like the K smallest one. That's the rank K. You know, the simplest case is I asked for like the median, right? So, here's a set of either 10 or 11 numbers. I think 11. Uh, what is the median of these numbers? 56.

1:05 >> 56. That you guys got >> I don't really know the answer. >> Anyone other than 56? Okay. 56. How many of these are smaller than it? One. 10 24 36 27 50 that's five that's smaller five that's bigger so seems like the median okay so that's that's basically kind of the goal given a list of numbers return the case smallest or the median or something like this okay what's like the most natural way to try to solve this yeah Oh, okay. So, that's just even to figure

1:58 out what K is, right? Okay. But suppose in general, I can give you a K. Ah, give me the 101st smallest number or something out of a big list. So, in other words, the N and K are already given to you. >> Ah, okay. Sorting. I think this is the most natural thing to do if you have sorted it from smallest to biggest. uh then you just look in the middle of the list or in the case slot, right? You

This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.

In this course

Related notes

Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Kent Quanrud.

Want the full transcript?

Save this video in YouTube Collector to get its complete searchable transcript, your own AI summaries, and a library that keeps every video you collect in one place.