In this tutorial we shall read about Kruskal’s algorithm and Implementation Kruskal’s algorithm is used to find MST in a graph. It is a greedy based algorithm. Why do we call it as greedy? Because, as you will see further, we choose the shortest distance …
First thing to understand is that this topic will come under Graphs not trees. Before solving questions related to Minimum Spanning Tree , we shall take a look on what are MST? In Minimum Spanning Tree, there is a sub part Spanning Tree. …
Ok, don’t be alarmed. Two pointer is no where related to C Language Pointers. In this context, two pointers simply mean there will be 2 variables that will be pointing to two different index of an array. Let us understand this approach with …
Greedy method is a simple technique that is easy to understand. Definition: In greedy approach, we make decision on the current information available at the present time without worrying about the affect on the future result. Let’s understand the above statement with help of …
Backtracking is a problem solving technique for the problems based on yes/no decision based problems. Here you are making a decision and if you encounter a result that is not acceptable because of a wrong decision you made, you will go back to the step where …
In this chapter we shall learn about below topics: What is dynamic programming Top down and bottom up approach Memonization and tabular method. In the previous chapter, we studied about recursion and saw recursion tree as below: From the above, the time complexity …
Definition: Recursion is a technique in which a function calls itself directly or indirectly. Directly means it will call itself. Indirectly means, it will call a function that will call itself recursively. Let’s understand recursion with help of example: Below is the program to …
Definition: A graph having Euler Path is called as Euler edge. Sometimes Euler path is also called as Euler Circuit. So, what is Euler path or Euler Circuit? A path which starts and ends at same vertex is called as Euler Path. It …