dsa2 min read
Merge K Sorted Lists
Merge K sorted linked lists into one sorted list using a min-heap to always extract the globally smallest node.
Read →
webcoderspeed.com
1276 articles
Merge K sorted linked lists into one sorted list using a min-heap to always extract the globally smallest node.
Find the Kth smallest element in an n×n row-and-column sorted matrix using binary search on value range or heap.
Find K pairs (u, v) with smallest sums from two sorted arrays using a min-heap initialized with first row candidates.
Find the nth ugly number (only prime factors 2, 3, 5) using three pointers for the 2x, 3x, 5x merge streams.
Maximize courses taken within deadlines by greedily scheduling and swapping out the longest past course.