# Tag Archives: BFS (adsbygoogle = window.adsbygoogle || []).push({});

## Find the ordering of tasks from given dependencies

There are a total of n tasks you have to pick, labeled from 0 to n-1. Some tasks may have prerequisites tasks, for example to… Read More »

## Minimum number of given operations required to make two strings equal

Given two strings A and B, both strings contain characters a and b and are of equal lengths. There is one _ (empty space) in… Read More »

## Edge Coloring of a Graph

In graph theory, edge coloring of a graph is an assignment of “colors” to the edges of the graph so that no two adjacent edges… Read More »

## Nutanix Interview Experience (On-Campus 2018)

The entire process consisted of 5 rounds: 1 online coding, 1 debugging, 2 Technical and 1 HR/System Design Round. The minimum criteria for the online… Read More »

## Detect cycle in an undirected graph using BFS

Given an undirected graph, how to check if there is a cycle in the graph? For example, the following graph has a cycle 1-0-2-1. Recommended:… Read More »

## Sudo Placement[1.3] | Final Destination

Given an array of integers and a number K with initial and final values. Your task is to find the minimum number of steps required… Read More »

## Minimum steps to reach end from start by performing multiplication and mod operations with array elements

Given start, end and an array of N numbers. At each step, start is multiplied with any number in the array and then mod operation… Read More »

## Minimum number of prefix reversals to sort permutation of first N numbers

Given N numbers which have a permutation of first N numbers. In a single operation, any prefix can be reversed. The task is to find… Read More »

## Largest connected component on a grid

Given a grid with different colors in a different cell, each color represented by a different number. The task is to find out the largest… Read More »

## Multi Source Shortest Path in Unweighted Graph

Suppose there are n towns connected by m bidirectional roads. There are s towns among them with a police station. We want to find out… Read More »

## Number of shortest paths in an unweighted and directed graph

Given an unweighted directed graph, can be cyclic or acyclic. Print the number of shortest paths from a given vertex to each of the vertices.… Read More »

## Shortest path in an unweighted graph

Given a unweighted graph, a source and a destination, we need to find shortest path from source to destination in the graph in most optimal… Read More »

## Smallest multiple of a given number made of digits 0 and 9 only

We are given an integer N. We need to write a program to find the least positive integer X made up of only digits 9’s… Read More »

## BFS using vectors & queue as per the algorithm of CLRS

Breadth-first search traversal of a graph using the algorithm given in CLRS book. BFS is one of the ways to traverse a graph. It is… Read More »

## Level of Each node in a Tree from source node (using BFS)

BFS(Breadth First Search) is a graph traversal technique where a node and its neighbors are visited first and then the neighbors of neighbors. In simple… Read More »