# Heaps

Heaps: Who's Next in the Emergency Room? Heaps, Fair Ties, Ready-Made: Priority Queues in Your Language.

Updated: November 17, 2026

1. [Who's Next in the Emergency Room? Heaps](https://www.ask-codey.com/lessons/ds-heaps) (Journeyman): Always call the most urgent patient next while new ones keep arriving, even on a day of 10,000: why an unsorted list and a sorted list both slow down, and the structure that fixes them, the heap, which keeps a tree in a plain array.
2. [Fair Ties, Ready-Made: Priority Queues in Your Language](https://www.ask-codey.com/lessons/ds-priority-queues) (Journeyman): See the most urgent patient first and, of two equally urgent, the one who has waited longer, with the priority queue your language already has (PriorityQueue in C# and Java, heapq in Python) or a small one in JavaScript and TypeScript, which have none.

Source: https://www.ask-codey.com/courses/data-structures/topics/ds-heaps
