## heapq in Python to print all elements in sorted order from row and column wise sorted matrix

Given an n x n matrix, where every row and column is sorted in non-decreasing order. Print all elements of matrix in sorted order. Examples:… Read More »

- Find k closest numbers in an unsorted array
- Introduction to Data Structures | 10 most commonly used Data Structures
- Find the smallest positive number missing from an unsorted array : Hashing Implementation
- Rearrange numbers in an array such that no two adjacent numbers are same
- Merge two sorted arrays in constant space using Min Heap
- Lexicographically smallest string formed by appending a character from first K characters of a string | Set 2
- Maximum possible sub-array sum after at most X swaps
- Reduce the array to a single integer with the given operation
- Maximise the number of toys that can be purchased with amount K using min Heap
- Pairing Heap
- Implementation of Non-Preemptive Shortest Job First using Priority Queue

Given an n x n matrix, where every row and column is sorted in non-decreasing order. Print all elements of matrix in sorted order. Examples:… Read More »

Given the sequence find the lexicographically smallest (earliest in dictionary order) derangement of . A derangement of S is as any permutation of S such… Read More »

Given two sorted arrays, the task is to merge them in a sorted manner. Examples: Input : arr1 = [1, 3, 4, 5] arr2 =… Read More »

Given any sequence , find the largest derangement of . A derangement is any permutation of , such that no two elements at the same… Read More »

Binary Heap is a complete tree (All levels are completely filled except possibly the last level and the last level has all keys as left… Read More »

Given an array of n positive integers. We are required to write a program to print the minimum product of k integers of the given… Read More »

Given an array of integers. Write a program to find the K-th largest sum of contiguous subarray within the array of numbers which has negative… Read More »

Given a binary min heap and a value x, print all the binary heap nodes having value less than the given value x. Examples :… Read More »

Given n tasks with arrival time, priority and number of time units they need. We need to schedule these tasks on a single resource. The… Read More »

We are given a list of N unsorted elements, we need to find minimum number of steps in which the elements of the list can… Read More »

make_heap() is used to transform a sequence into a heap. A heap is a data structure which points to highest( or lowest) element and making… Read More »

A leftist tree or leftist heap is a priority queue implemented with a variant of a binary heap. Every node has an s-value (or rank… Read More »

Given that integers are being read from a data stream. Find median of all the elements read so far starting from the first integer till… Read More »

Given k sorted linked lists each of size n, merge them and print the sorted output. Examples: Input: k = 3, n = 4 list1… Read More »

Given a stream of integers represented as arr[]. For each index i from 0 to n-1, print the multiplication of largest, second largest, third largest… Read More »