Algorithms questions

Q20

GATE CS 2023 CSSearching Sorting and HashingMCQ1 mark−1/3 if wrong
An algorithm has to store several keys generated by an adversary in a hash table. The adversary is malicious who tries to maximize the number of collisions. Let kk be the number of keys, mm be the number of slots in the hash table, and k>mk > m.

Which one of the following is the best hashing strategy to counteract the adversary?
Show answer without attempting

Answer: C

Q29

GATE CS 2023 CSAlgorithm AnalysisMSQ1 mark
Let ff and gg be functions of natural numbers given by f(n)=nf(n) = n and g(n)=n2g(n) = n^2.
Which of the following statements is/are TRUE?
More than one option can be correct.
Show answer without attempting

Answer: A, C

Q54

GATE CS 2023 CSAlgorithm AnalysisMSQ2 marks
Consider functions Function_1 and Function_2 expressed in pseudocode as follows:
Function_1
while n > 1 do
  for i = 1 to n do
    x = x + 1;
  end for
  n = ⌊n/2⌋;
end while

Function_2
for i = 1 to 100 * n do
  x = x + 1;
end for
Let f1(n)f_1(n) and f2(n)f_2(n) denote the number of times the statement "x=x+1x = x + 1" is executed in Function_1 and Function_2, respectively.

Which of the following statements is/are TRUE?
More than one option can be correct.
Show answer without attempting

Answer: A, D

Q56

GATE CS 2023 CSGraph AlgorithmsNAT2 marks
Let U={1,2,3}U = \{1, 2, 3\}. Let 2U2^U denote the powerset of UU. Consider an undirected graph GG whose vertex set is 2U2^U. For any A,B∈2UA, B \in 2^U, (A,B)(A, B) is an edge in GG if and only if (i) A≠BA \neq B, and (ii) either A⊊BA \subsetneq B or B⊊AB \subsetneq A. For any vertex AA in GG, the set of all possible orderings in which the vertices of GG can be visited in a Breadth First Search (BFS) starting from AA is denoted by B(A)\mathcal{B}(A).

If ∅\emptyset denotes the empty set, then the cardinality of B(∅)\mathcal{B}(\emptyset) is ____________.
Show answer without attempting

Answer: 5040

0/40 correct0 marks

Related topics in GATE CS