⚡ Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 20m 26s17 days 22 hours 20 minutes 26 seconds.
⚡ Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 20m 26s17 days 22 hours 20 minutes 26 seconds.

Sign in to watch this lesson
Algorithms - Linear Data Structures · 5:13
A binary heap is an array read as a tree: the children of index i sit at 2i+1 and 2i+2, and every parent is no larger than its children. We push 5, 3, 8, 1, 9, 2 with sift-up to get [1, 3, 2, 5, 9, 8], pop with sift-down to get [2, 3, 8, 5, 9], see why std::priority_queue is a max-heap by default, and measure bottom-up heapify against one push at a time on this Mac. Then two patterns: top-k with a size-k min-heap, and a first look at the running median with two heaps.