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 …
In this tutorial we shall learn about bipartite graph. Definition: A graph G(V, E) is called as bipartite graph if all the vertices (V) can be divided into 2 distinct disjoint non empty sets V1 and V2 such that every edge in the graph connects a …
In previous chapter we learnt about graph traversal in general. In this chapter we shall learn how to do graph traversal using Stack and Queue. DFS graph traversal using Stack: As in DFS traversal we take a node and go in depth, till we …