ProDeveloperTutorialonJanuary 19, 2025 Dynamic Programming: Binomial Coefficiet Problem Problem Statement: You are given 2 values, n & k. You need to find the binomial coefficient of the values. Binomial Coefficient is…
ProDeveloperTutorialonJanuary 19, 2025 0 1 Knapsack Problem using Dynamic Programming Solution Before we start with with the solution. Let us understand the basic of DP in series of points as below: 1. DP will be built on top of…
ProDeveloperTutorialonJanuary 19, 2025 Detect a cycle in a undirected graph Problem Statement: You are given a undirected graph. You need to find out if the graph contains cycle or not. Example Solution We can use DFS…
ProDeveloperTutorialonJanuary 19, 2025 Detect a cycle in a directed graph Problem Statement: You are given a directed graph. You need to find out if the graph contains cycle or not. Example Solution We shall use DFS…
ProDeveloperTutorialonJanuary 19, 2025 Heaps: Merge “K” sorted arrays Problem Statement: You are given k sorted arrays of size n each. You need to merge them and print the sorted output. Example k = 3, n = 4…
ProDeveloperTutorialonJanuary 19, 2025 Heaps: Find kth smallest in an unsorted array Problem Statement: You are given an array and a number K, you need to find the kth smallest element. Example Input: arr[] = {5, 20, 10, 7, 1},…
ProDeveloperTutorialonJanuary 19, 2025 Heaps: Sort an Array using heap Problem Statement: Given an array, sort it by using heap sort. Solution Relationship between array and heap elements. As we know that heaps…
ProDeveloperTutorialonJanuary 19, 2025 Heaps: Build Min Heap from an Array Problem Statement: You are given N array elements. You need to build a Min Heap. Solution Min Heap: The root element is greater than its…
ProDeveloperTutorialonJanuary 19, 2025 Next Smaller Element Problem Statement: YOu are given an unsorted array, you need to find the next smaller element for all the elements. Next smaller element for…
ProDeveloperTutorialonJanuary 19, 2025 Reverse the first “K” elements of a queue Problem Statement: You are given a queue and an element k, you need to reverse the first ‘k’ elements in the queue. Example Input:…