Problem Statement: You are given a string “s” and a pattern ‘p’. You need to find if the pattern is present in the string “s”. Usually we can solve this by brute force approach. i.e comparing one letter after another, till we find the sub …

Bellman Ford algorithm us used to find shortest path from source to destination. It can be solved through Dynamic Programming approach. A simple example can be thought as travelling from city A to city B. There are multiple routs, you need to find the route …

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 …