Sort¶
How To: Sort
Merge overlapping intervals
Insert new interval (merge if necessary)
Sort colors [Tri Partition]
Merge sorted array
Insertion sort of linked list
Sort a linked list
Maximum gap between successive elements [Tricky]
Largest number from list of integers
The skyline problem [Divide and Conquer, BST, Heap]
Meeting rooms (meeting time intervals)
Meeting rooms II
Compute researcher’s H-index of citations [Counting Sort]
Wiggle sort
Wiggle sort II [Tri Partition]
Top K frequent elements [Quick Select, Heap, Bucket Sort]
Queue reconstruction by height [Tricky]
Sort characters by frequency
Top K frequent words [Quick Select, Heap, Bucket Sort]
Sort an array [Merge Sort, Quick Sort]
Reorder log files
Pancake sorting
K closest points to origin [Divide and Conquer, Quick Select, Heap]
Largest perimeter triangle
Distant barcodes [var. of Rearrange string k distance apart]
High five [Heap]
Car pooling [var. of Meeting rooms II]
Relative sort array
Meeting Scheduler [Heap, Line Sweep]
Sort integers by the number of 1 bits [Bit Manipulation]
How Many Numbers Are Smaller Than the Current Number [Counting Sort]
Rank teams by votes
Bubble Sort - O(N^2) - Sorting by Exchange
Selection Sort - O(N^2) - Segments List to Parts
Insertion Sort - O(N^2) - Segments List to Parts
Shell Sort - O(N^2) - In-place Comparison
Merge Sort - O(NLog(N)) - Divide and Conquer
Quick Sort - O(NLog(N))..O(N^2) - Divide and Conquer
Counting Sort
Counting sort
Heap sort - O(NLog(N))
Quick sort and Hoar sort
sorted() function
O(N^2) Sort Algorithms
Merge 2 sorted lists
Check if array is sorted