Algorithms questions

Q17

GATE CS 2024 CS-1Algorithm AnalysisMCQ1 mark−1/3 if wrong
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 through the array and comparing each element of the array only with its adjacent elements. The worst-case time complexity of this algorithm is
Show answer without attempting

Answer: A

Q42

GATE CS 2024 CS-1Algorithm AnalysisMCQ2 marks−2/3 if wrong
Consider the following recurrence relation:
T(n)={nT(n)+nfor n≥1,1for n=1.T(n) = \begin{cases} \sqrt{n}T(\sqrt{n}) + n & \text{for } n \ge 1, \\ 1 & \text{for } n = 1. \end{cases}
Which one of the following options is CORRECT?
Show answer without attempting

Answer: A

Q45

GATE CS 2024 CS-1Graph AlgorithmsMSQ2 marks
Let GG be a directed graph and TT a depth first search (DFS) spanning tree in GG that is rooted at a vertex vv. Suppose TT is also a breadth first search (BFS) tree in GG, rooted at vv. Which of the following statements is/are TRUE for every such graph GG and tree TT?
More than one option can be correct.
Show answer without attempting

Answer: C

Q60

GATE CS 2024 CS-1Graph AlgorithmsNAT2 marks
The number of edges present in the forest generated by the DFS traversal of an undirected graph GG with 100 vertices is 40. The number of connected components in GG is _________
Show answer without attempting

Answer: 60

Q59

GATE CS 2024 CS-2Graph AlgorithmsNAT2 marks
The number of distinct minimum-weight spanning trees of the following graph is _________
Question figure
Show answer without attempting

Answer: 9

0/50 correct0 marks

Related topics in GATE CS