Minimum Spanning Tree tutorial 3. Introduction to Prim’s algorithm

In this chapter we shall learn about below topics: 3.1 Introduction to Prim’s algorithm. 3.2 Conditions for Prim’s algorithm to work. 3.3 Working steps of Prim’s algorithm. 3.4 Understanding Prim’s algorithm with the help of an example. 3.5 Implementation of Prim’s algorithm. 3.6 Output 3.1.  Introduction to Prim’s algorithm tree. In this tutorial we shall […]

Minimum Spanning Tree tutorial 2: Introduction to Kruskal’s algorithm

In this chapter we shall learn about below topics: 2.1 Introduction to Kruskal’s algorithm. 2.2 Conditions for Kruskal’s algorithm to work. 2.3 Working steps of Kruskal’s algorithm. 2.4 Understanding Kruskal’s algorithm with the help of an example. 2.5 Implementation of Kruskal’s algorithm. 2.1 Introduction to Kruskal’s algorithm tree: Kruskal’s algorithm is used to find MST […]

Minimum Spanning Tree tutorial 1. Introduction to minimum spanning tree

In this chapter we shall learn about below topics: 1.1 Introduction to spanning tree 1.2 What is minimum spanning tree? 1.3 Usage of minimum spanning tree. First thing to understand is that this topic will come under Graphs not trees. Before solving questions related to Minimum Spanning Tree [MST], we shall take a look on […]

Introduction to Two pointer approach with example code

Ok, don’t be alarmed. Two pointer is nowhere 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 help of an example and understand how it will increase the efficiency of […]

Introduction to Greedy Technique with example

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 effect on the future result. Let’s understand the above statement with help of an example. Consider the graph below, you need to go from […]

Introduction to Backtracking Approach with example

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 you made wrong decision and try to make different […]

Introduction to Dynamic Programming with example

In this chapter we shall learn about below topics: 3.1 What is dynamic programming 3.2 Top down / Memonization approach 3.3 C++ program to find Fibonacci series using Memonization technique 3.4 Bottom up approach / Tabular method  3.5 C++ program to find Fibonacci series using Tabular technique. 3.1 What is dynamic programming In the previous […]

Introduction to Recursion with stack frame and recursion tree

From the above program we shall understand how stack frame gets effected when using recursion function. So we called the function with n = 3 value. We know that, in C, local c variables are stored in stack. When you call a function, it’s activation record along with unction parameters are also stored. So from […]

Introduction to Brute force approach with example

In this chapter we shall learn about: 1.1 Introduction to brute force approach 1.2 Understanding Brute force approach with an example 1.3 C++ program to perform brute force approach on string search 1.4 Output 1.5 Examples of Brute force approach 1.6 String searching algorithms 1.1 Introduction to brute force approach Brute force approach can also […]

Graph data structure tutorial 10. Hamiltonian Graph

In this tutorial we shall learn about Hamiltonian graph. Definition: A graph that contains Hamiltonian circuit is called as Hamiltonian graph. What is Hamiltonian circuit? A path that passes through every vertex exactly once is called as Hamiltonian circuit. It should return to the original starting vertex. Example: Now we have to find if we […]