23. Merge k Sorted Lists https://leetcode.com/problems/merge-k-sorted-lists
373. Find K Pairs with Smallest Sums https://leetcode.com/problems/find-k-pairs-with-smallest-sums
378. Kth Smallest Element in a Sorted Matrix https://leetcode.com/problems/kth-smallest-element-in-a-sorted-matrix
313. Super Ugly Number https://leetcode.com/problems/super-ugly-number
355. Design Twitter https://leetcode.com/problems/design-twitter
215. Kth Largest Element in an Array https://leetcode.com/problems/kth-largest-element-in-an-array
451. Sort Characters By Frequency https://leetcode.com/problems/sort-characters-by-frequency
703. Kth Largest Element in a Stream https://leetcode.com/problems/kth-largest-element-in-a-stream
347. Top K Frequent Elements https://leetcode.com/problems/top-k-frequent-elements
692. Top K Frequent Words https://leetcode.com/problems/top-k-frequent-words
1845. Seat Reservation Manager https://leetcode.com/problems/seat-reservation-manager
295. Find Median from Data Stream https://leetcode.com/problems/find-median-from-data-stream
870. Advantage Shuffle https://leetcode.com/problems/advantage-shuffle
1834. Single-Threaded CPU https://leetcode.com/problems/single-threaded-cpu
Prerequisites
Before reading this article, you need to learn:
The main application of a binary heap is a priority queue, which is characterized by dynamic sorting. Elements inserted can automatically maintain the correct order. Of course, a binary search tree can also achieve dynamic sorting, but the priority queue provides a simpler interface and is easier to implement.
Generally, problems that use priority queues can be divided into two categories. One category involves merging multiple sorted sequences into one, and the other involves finding the k
-th largest element in multiple sorted sequences. Let's look at each category separately.
First, let's look at the first category, which includes problems similar to merging sorted linked lists.