Heap

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…

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…