algorithms
GATE CSE & IT · Data Structures and Algorithms - Graph Traversal (BFS) · 2011-2025
Study anchor
Source-book anchor pending for this concept.
Practice action
Start latest PYQPYQs in this concept
All concepts →Let G be any undirected graph with positive edge weights, and T be a minimum spanning tree of G. For any two vertices, u and v, let d₁(u, v) and d₂(u, v) be the shortest distances...
Consider an unordered list of N distinct integers. What is the minimum number of element comparisons required to find an integer in the list that is NOT the largest in the list?
Which of the following statement(s) is/are TRUE for any binary search tree (BST) having n distinct integers?
Let G be an edge-weighted undirected graph with positive edge weights. Suppose a positive constant $\alpha$ is added to the weight of every edge. Which ONE of the following stateme...
Consider the following algorithm someAlgo that takes an undirected graph G as input. someAlgo (G) 1. Let v be any vertex in G. Run BFS on G starting at v. Let u be a vertex in G at...
Given an integer array of size N, we want to check if the array is sorted (in either ascending or descending order). An algorithm solves this problem by making a single pass throug...
Let A be an array containing integer values. The distance of A is defined as the minimum number of elements in A that must be replaced with another integer so that the resulting ar...
Let S1 and S2 be two stacks. S1 has capacity of 4 elements. S2 has capacity of 2 elements. S1 already has 4 elements: 100, 200, 300, and 400, whereas S2 is empty, as shown below. 4...
Match the algorithms with their time complexities: Algorithm (P) Towers of Hanoi with n disks (Q) Binary search given n sorted numbers (R) Heap sort given n numbers at the worst ca...
The Breadth First Search (BFS) algorithm has been implemented using the queue data structure. Which one of the following is a possible order of visiting the nodes in the graph belo...
$$G = (V,E)$$ is an undirected simple graph in which each edge has a distinct weight, and e is a particular edge of G. Which of the following statements about the minimum spanning...
Which of the given options provides the increasing order of asymptotic Complexity of functions f 1 , f 2 , f 3 and f 4 ? f 1 = 2 n f 2 = n 3/2 f 3 (n) = $$n\,\log _2^n$$ f 4 (n) =...