# standard-problem

## How to detect negative edge weight cycle in a graph ?

Given a directed weighted graph with possibly negative edge weights, how to detect the presence of a negative edge weight cycle in the graph ? What is a negative edge weight cycle ? The weight of a cycle in a graph is the sum of all the edge weights in the cycle for the graph. …

## Snake and Ladder Problem

Problem statement Given a snake and ladder coordinates which represent the actual snake and ladder board, find the minimum number of dice throws required to reach the destination cell from source cell. This problem can be easily solved bu using 0-1 BFS. Example Input Expected Output Implementation in Python

## Topological Sorting

In graph theory, a topological sorting of a directed graph is a linear ordering of vertices of graph such that if there is a directed edge uv from vertex u to vertex v, u comes before v in the ordering. Note: Graph must be directed and acyclic. Example Input Expected Output 0 2 1 3 Pseudocode Implementation in Python

## Depth First Traversal for a Graph

Depth First Search (BFS) is a recursive graph traversal algorithm that is used to traverse all the vertices of a graph in a depthward motion. In other words, it starts the graph traversal from root node and explores all the branches. Example of Depth First Traversal for a Graph Depth First Traversal is used to traverse all the vertices of …

## How to check if two binary trees are identical ?

Given two binary trees, write a program to check if the two binary trees are identical or not ? Solution We can solve the above problem recursively. If the root node of the tree is equal then we check for the equality of left subtree and right subtree.Similarly, we check for the equality of the …

## Edit Distance | Dynamic Programming

Edit distance The Edit distance is a problem to measure how much two strings are different from one another by counting the minimum number of operations required to convert one string into the other. Edit distance problem can be solved by many different approaches.But the most efficient approach to solve the Edit distance problem is …

## Kruskal’s Minimum Spanning Tree Algorithm

Kruskal’s Minimum Spanning Tree Algorithm The Kruskal’s Minimum Spanning Tree Algorithm is an algorithm which is used to construct a Minimum Spanning Tree for a connected weighted graph. Kruskal’s algorithm to find the minimum cost spanning tree uses the greedy approach. This algorithm works on principle of finding the subset of the edges from the …

## Dijkstra’s Shortest Path Algorithm

Dijkstra’s Shortest Path Algorithm The Dijkstra’s Shortest Path algorithm is a greedy algorithm which is used for finding the shortest path between nodes in a graph. This algorithm finds the shortest path between the two nodes but it can be used for finding the shortest paths from a single node to all other nodes by …

## How to recursively print a linked list ?

How to print a given linked list recursively ? In this post, we will see step by step on how to print a linked list recursively.

Scroll to Top
[gravityforms id="5" description="false" titla="false" ajax="true"]