Heaps

  • Find K Pairs with Smallest Sum
    You are given two integer arrays nums1 and nums2 sorted in non-decreasing order and two integers k and target. Find k pairs (a, b) from the arrays such that a + b is the smallest possible value, and a + b is less than or equal to target. Return the pairs in sorted order.
  • C++ Heap or Priority Queues
    A heap is a specialized binary tree-based data structure. It is a complete binary tree (all levels are completely filled except possibly the last one, which is filled from left to right) where each node satisfies the heap property.