Constant Time
Constant Time
Heaps

Heaps

⭐  Highly recommended

  1. Kth largest/smallest element in an array
    1. kth largest/smallest in an array. ⭐ 
    2. The Greedy merchant—"No one is wise from another man's woe” ⭐ 
    3. Array vs Stream—”to heapify or not to heapify”
    4. Similar Questions : Kth Element ⭐ 
    5. Quick select (Optional)
  2. Heaps with a payload
    1. K Closest Points to Origin ⭐ 
    2. Similar Questions: Heaps with a payload
  3. A deeper dive
    1. Heap vs Priority Queue ⭐
    2. A heap up close: Simulating a max heap ⭐
  4. Heaps and Sorting
    1. Sort a nearly sorted (or K sorted) array
    2. HeapSort: The simplest sorting algorithm.
  5. Heaps and a greedy mindset
    1. Reorganize String ⭐ 
    2. Ugly number, Not that Ugly to be honest!
    3. Similar Questions : Greedy ⭐ 
  6. Heap as a pointer/K-way merge
    1. Merge K Sorted Arrays ⭐ 
    2. Design Twitter (K way merge in Reverse)
    3. Smallest Range Covering Elements from K Lists
    4. Similar Questions : K way Merge ⭐ 
  7. Two heaps
    1. Median from Data Stream ⭐ 
    2. Similar Questions: Two Heaps
‣
Logo
YouTubeDiscord