# Tag Archives: DFS

## Dinic’s algorithm for Maximum FlowFebruary 25, 2017

Problem Statement : Given a graph which represents a flow network where every edge has a capacity. Also given two vertices source ‘s’ and sink… Read More »

## Convert a tree to forest of even nodesFebruary 3, 2017

Given a tree of n even nodes. The task is to find the maximum number of edges to be removed from the given tree to… Read More »

## Find if an array of strings can be chained to form a circle | Set 2December 7, 2016

Given an array of strings, find if the given strings can be chained to form a circle.

## Longest path between any pair of verticesOctober 17, 2016

We are given a map of cities connected with each other via cable lines such that there is no cycle between any two cities. We… Read More »

Given two integers ‘n’ and ‘m’, find all the stepping numbers in range [n, m]. A number is called stepping number if all adjacent digits… Read More »

## Flatten a multi-level linked list | Set 2 (Depth wise)July 23, 2016

We have discussed flattening of a multi-level linked list where nodes have two pointers down and next. In the previous post, we flattened the linked… Read More »

## Iterative Deepening Search(IDS) or Iterative Deepening Depth First Search(IDDFS)May 19, 2016

There are two common ways to traverse a graph, BFS and DFS. Considering a Tree (or Graph) of huge height and width, both BFS and… Read More »

## Find a Mother Vertex in a GraphMarch 28, 2016

What is a Mother Vertex? A mother vertex in a graph G = (V,E) is a vertex v such that all other vertices in G… Read More »

## Detect Cycle in a directed graph using colorsMarch 12, 2016

Given a directed graph, check whether the graph contains a cycle or not. Your function should return true if the given graph contains at least… Read More »

## BFS vs DFS for Binary TreeFebruary 22, 2016

What are BFS and DFS for Binary Tree? A Tree is typically traversed in two ways: Breadth First Traversal (Or Level Order Traversal) Depth First… Read More »

## Top 10 Algorithms and Data Structures for Competitive ProgrammingDecember 16, 2015

In this post “Important top 10 algorithms and data structures for competitive coding “. Topics : Graph algorithms Dynamic programming Searching and Sorting: Number theory… Read More »

## Top 10 algorithms in Interview QuestionsDecember 9, 2015

In this post “Top 10 coding problems of important  topics with their solutions ” are written. If you are preparing for a coding interview, going through… Read More »

## Iterative Depth First Traversal of GraphOctober 23, 2015

Depth First Traversal (or Search) for a graph is similar to Depth First Traversal (DFS) of a tree. The only catch here is, unlike trees,… Read More »

## Print all Jumping Numbers smaller than or equal to a given valueOctober 16, 2015

A number is called as a Jumping Number if all adjacent digits in it differ by 1. The difference between ‘9’ and ‘0’ is not… Read More »

## Find same contacts in a list of contactsAugust 24, 2015

Given a list of contacts containing username, email and phone number in any order. Identify the same contacts (i.e., same person having many different contacts)… Read More »