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… Discover More
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… Discover More
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… Discover More
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},… Discover More
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… Discover More
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… Discover More
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… Discover More
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:… Discover More
ProDeveloperTutorialonJanuary 19, 2025 Queue Reversal Problem Statement: Given a queue, you need to reverse it. Solution This problem can be solved in 2 different methods. Method 1: Using stack.… Discover More
ProDeveloperTutorialonJanuary 19, 2025 Stack: Check if a stack is a permutation of another stack Problem Statement: You are given 2 array, check one array is permutation of another array. Example Input : First array: 1, 2, 3 Second array:… Discover More