Which of the following statement(s) is/are FALSE?

I: Insertion sort runs faster than merge sort if input sequences are already sorted.

II: Heap sort and selection sort time complexity will not depend on input sequence.

III. Heap sort and Quicksort are not stable algorithms

I and II
II and III
I, II and III
None of the above
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Consider the following functions

S1= √n logn

S2= (logn)^2

S3= n^0.4

Which of the following statements is represented asymptotically correct?

S3=O(S1) and S1=O(S2)
S2=Ω(S3) and S2=O(S1)
S3=Ω(S1) and S1=O(S2)
S2=O(S3) and S3=Ω(S2)
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Find the worst case time complexity for given below code segment

void Bob()

{

int i,j,k;

for(i=0; i<n*n; i++)

for(j=0; j<i; j++)

printf(“GATE 2021”);

for(k=0; k<n*n; k++)

for(m=0; m<k*k; m++)

printf(“GATE 2021”);

}

n^4
n^6
n^2
None
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Find the worst case time complexity for given below code segment

n √n logn
nlogn
(logn)^2
loglogn * (logn)^2
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
How many minimum spanning trees(MST) are possible for a given graph is____?

125
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
What is the worst case time complexity of below code segments

int Bob(int a,int n)

{

int n,x;

if(n==0)

return 1;

else

x=Bob(a,⌊n/2⌋)

if((n%2)!=0)

return a*x*x;

else

return x*x;

}

O(log2n)
O(n)
O(log2n)^2
O(nlog2n)
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Fill in the blanks for the most suitable answer.

I. Primary Clustering is the tendency for a collision resolution scheme such as _______to create long runs of filled slots near the hash position of keys.

II. Secondary Clustering is the tendency for a collision resolution scheme such as _______to create long runs of filled slots away from the hash position of keys.

Linear probing and Quadratic probing
Linear probing and Linear probing
Quadratic probing and Quadratic probing
Quadratic probing and Linear probing
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Construct max heap for the given an array of elements.

Insert the element 55 after constructing the max heap and Find the value of index 5 is _?

[ Hint: Index of an array starts with 0 ]

36
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
Find the minimum number of machines required to schedule all the jobs____?

Job

A

B

C

D

E

F

Start Time

2

3

1

6

7

8

End Time

3

7

4

9

11

12

3
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
The most appropriate matching for the following pairs

List-A

List-B

P: Binary Search Tree

1: Stack

Q: 0/1 knapsack problem

2: Greedy

R: Huffman Coding

3: Dynamic programming

S: Depth-first Search

4: Divide and Conquer

P-2, Q-3, R-4, S-1
P-2, Q-4, R-3, S-1
P-4, Q-3, R-2, S-1
P-4, Q-2, R-3, S-1
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Find the total number of strongly connected components for a given graph is ____?

3
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
Given an undirected graph.

Find the total cost of the second best minimum Spanning tree(MST) _____?

[ Note: A second best MST is a spanning tree, that has the second minimum weight sum of all the edges, from all the possible spanning trees of the graph G ]

19
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
What is the length of the longest common subsequence(LCS) of the given below two string X and Y are ____________?

X = pqsprutrts

Y = qrstupqrs

5
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
What is the worst case time to delete a random element in a binary heap?
O(logn)
O(n)
O(nlogn)
O(n^2)
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Consider a set of 512 elements to find minimum and maximum elements in the given set. Find the minimum number of comparisons required is___?
766
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
How many passes of bubble sort are required to sort the following sequence _______?

A={ 20,16,1,10,13, 15, 9, 12, 11}

[ Hint: Pass is counted only when at least one swap is performed in the bubble sort pass ]

5
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
Consider two strings A = "zazrpzqrst" and B = "arzazrsatq". Let ‘X’ be the length of the longest common subsequence (not necessarily contiguous) between A and B and let ‘Y’ be the number of such longest common subsequences between A and B.

Find (5x+4y)%(x+y) = ______?

6
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
Given an undirected graph.

Find the total cost of the Minimum Spanning Tree(MST) using kruskal’s algorithm is___?

47
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
The most appropriate matching for the following pairs

P-4, Q-3, R-5, S-2
P-2, Q-3, R-1, S-4
P-2, Q-7, R-3, S-5
P-6, Q-1, R-3, S-7
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Which of the following arrays violates a Max Heap property (Note: An array starts with 0th index)?

P)

45

35

25

26

30

23

20

21

22

25

26

15

14

10

9

Q)

75

55

45

46

43

30

29

30

25

32

35

20

19

18

17

R)

75

55

45

46

43

30

29

30

25

32

35

31

19

18

17

S)

45

35

25

26

30

23

20

21

22

25

26

15

14

22

9

Both P and Q
Both Q and R
Both R and S
Both S and P
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
There are 5 elements named as A,B,C,D,E are sorted sequences having lengths 25,29,35,40,55 respectively. They are to be merged into a single sequence by merging together two sequences at a time. The number of comparisons that will be needed in the worst case by the optimal algorithm for doing this is ___?
418
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
Assume Dijkstra’s algorithm is used to find the shortest paths from node ‘0’ in the following graph.

The number of edges which are not included in any of the shortest paths from node ‘0’ is ______?

4
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
Let P be a Quicksort Program to sort numbers in ascending order using the last element as pivot. Let t1 and t2 be the number of comparisons made by P for the inputs {2, 2, 2, 2, 2} and {10, 20, 30, 40, 50} respectively. Which one of the following holds?
t1 = 5
t1< t2
t1 > t2
t1 = t2
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider a matrix multiplication chain ABCDE, where matrices A,B,C,D and E are of dimensions 6x7, 7x9, 9x3, 3x7 and 7x8 respectively. In the parenthesization of ABCDE that minimizes the total number of scalar multiplications. Find the correct explicit computed pairs to get the minimum number of scalar multiplications.

[ Hint: For example, in the matrix multiplication chain PQRSTU using parenthesization (P(QR))(S(TU)), QR and TU are only explicitly computed pairs ]

(AB) and (BC)
(BC) and (DE)
Only (BC)
(AB) and (DE)
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
A statement is made up of characters P,Q,R,S,T each occurring with the probability 0.11, 0.40, 0.16, 0.09, 0.24 respectively. The optimal Huffman coding technique will have the average length of____? [ Note: Consider only 2 decimal points if it is necessary ]
2.16
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
An undirected graph G(V,E) contains n (n>2) nodes named V1,V2,..,Vn. Two nodes Vi and Vj are connected if and only if 0<|i-j|<=2. Each edge(Vi,Vj) is assigned a weight i+j. The cost of a minimum spanning tree of such a graph with 16 nodes is___?
241
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
Consider the following program

int Bob(n)

{

if (n == 1)

Alice();

else

John() + Bob(n-1);

}

What is the time complexity for the given function, if the function ‘Alice’ and ‘John’ take O(1) and O(logn) units of time respectively.

O(n)
O(n^2)
O(nlog n)
O(logn)
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following table and the maximum capacity(M)=7

A

B

C

D

Weight

1

3

4

5

Profit

1

4

5

7

Find the maximum profit obtained by placing objects into the knapsack using 0/1 Knapsack algorithm?

9
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
Consider the following graph and a matrix contains distance between the cities.

Find the minimum cost of tour by visiting all the cities available in the graph from the city 1.

35
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
Consider the following message:

PPP QQQQ P Q RRR SSSS RRRRR QQQ SS RRR

If Huffman tree code has left child with ‘1’ and right child with ‘0’ from every node then what is the decoded message for 1001010001.

RSPQR
RPQSR
RQPSR
RPQRR
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following insertion sort algorithm.

X: A[i] > Key

Y: A[j] = A[i];

X: A[i] > Key

Y: A[i + 1] = A[i];

X: A[i] < Key

Y: A[i + 1] = A[i];

X: A[i] < Key

Y: A[j] = A[i];

Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
The following Knapsack bag. The Knapsack bag maximum Capacity is 50. What is the maximum profit using Greedy Knapsack technique is _____?

Objects

P

Q

R

S

T

V

W

X

Weights

18

12

16

14

16

20

10

15

Profits

36

18

22

16

20

32

18

26

91.2
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
Which of the following statement(s) is/are TRUE?

I. Consider an array containing ‘n’ elements which are in increasing order. The efficient time complexity to search one element which is not present in an array will take O(logn)

II. Counting sort uses Radix sort as a subroutine

III. Overlapping subproblems and Optimal Substructure properties are required to solve dynamic programming

I and II
II and III
I and III
I, II and III
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66