info@digitalbithub.com
DigitalBitHubLearn

Algorithms

Previous Year Questions
Gate CSGate CS 2024 (1)| Question - 17 | Algorithms

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

Gate CSGate CS 2022 | Question - 15 | Algorithms

Consider the problem of reversing a singly linked list. To take an example, given the linked list below, the reversed linked list should look like Which one of the following statements is TRUE about the time complexity of algorithms that solve the above problem in O(1) space?

Gate CSGate CS 2020 | Question - 2 | Algorithms

For parameters a and b, both of which are (1), T(n) = T(n1/a) + 1, and T(b) = 1. Then T(n) is

Gate CSGate CS 2020 | Question - 16 | Algorithms

What is the worst-case time complexity of inserting n elements into an empty linked list, if the linked list needs to be maintained in sorted order?

Gate CSGate CS 2020 | Question - 31 | Algorithms

Let G = (V, E) be a weighted undirected graph and let T be a Minimum Spanning Tree (MST) of G maintained using adjacency lists. Suppose a new weighed edge (u,v) VV is added to G. The worst-case time complexity of determining if T is still an MST of the resultant graph is

Gate CSGate CS 2020 | Question - 40 | Algorithms

Let G = (V, E) be a directed, weighted graph with weight function w: ER. For some function f: VR, for each edge (u, v) E, define w'(u,v) as w(u,v)+f(u)-f(v). Which one of the options completes the following sentence so that it is TRUE?? "The shortest paths in G under w are shortest paths under w' too,_____".

Gate CSGate CS 2020 | Question - 47 | Algorithms

Consider the array representation of a binary min-heap containing 1023 elements. The minimum number of comparisons required to find the maximum in the heap is ________?

Gate CSGate CS 2020 | Question - 49 | Algorithms

Consider a graph G = (V, E), where V = {v1, v2,..., v100}, E = {(vi, vj) | 1 i j 100}, and weight of the edge (vi, vj)is |i-j|. The weight of minimum spanning tree of G is ______.

Related Topics