1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-09-25 00:21:28 +02:00

Fix duplicate links in Two Heaps documentation

Removed duplicate resource links for Two Heaps.
This commit is contained in:
Kamran Ahmed
2025-09-09 11:28:37 +01:00
committed by GitHub
parent 0b1b5cb8e7
commit d2fa463a1e

View File

@@ -1,7 +1,8 @@
# Two Heaps
The two heaps method uses a max-heap to store the lower half of the numbers and a min-heap to store the upper half. This setup allows you to quickly access the largest value of the lower half and the smallest value of the upper half in constant time. Insertions and deletions take logarithmic time, and the heaps are balanced so that the median can be found in O(1) time. This approach is especially useful for dynamically maintaining the median of a long or streaming data sequence, where repeatedly sorting the data would be inefficient (O(n log n) per sort).
Learn more from the following resources:
- [@article@Two Heaps — A Coding Pattern for Median-finding (Emre Bolat)](https://emre.me/coding-patterns/two-heaps/)
- [@video@Coding Pattern - Two Heaps (Imran Sarwar)](https://www.youtube.com/watch?v=9P7W5aEaatQ)
- [@article@Two Heaps — A Coding Pattern for Median-finding (Emre Bolat)](https://emre.me/coding-patterns/two-heaps/)
- [@video@Coding Pattern - Two Heaps](https://www.youtube.com/watch?v=9P7W5aEaatQ)