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

Sign in to watch this lesson
Algorithms - Linear Data Structures · 3:58
A queue hands items out in the order they arrived. We draw a capacity-8 ring buffer as a clock face: ticks 101 to 108 fill it, 109 has to wait, two reads free slots and the producer wraps from slot 7 back to slot 0. Two ever-growing counters tell full from empty, and a power-of-two mask picks the slot; on this Mac the mask beat a general modulo and the ring beat std::queue. Then libc++'s std::deque: 4 KB blocks and a map of pointers, a new block on push_front, stable references, slower scans than a vector, plus a queue made of two stacks.