GATE || Tree | Hashing || PYQS (2010 to 2025)

Last Updated :
Discuss
Comments

Question 1

In a double hashing scheme, h1(k)= k mod 11 and h2(k)=1+(k mod 7) are the auxiliary hash functions. The size m of the hash table is 11. The hash function for the i-th probe in the open address table is [h1(k)+ih2(k)] mod m The following keys are inserted in the given order: 63, 50, 25, 79, 67, 24.

The slot at which key 24 gets stored is _________. (Answer in integerg

Gate 2025 SET-01 || PYQ || Hashing

  • 10

Question 2

Let T be a binary search tree with 15 nodes. The minimum and maximum possible heights of T are:

Note: The height of a tree with a single node is 0. 2017 SET 1 || MCQ || 1-mark

  • 4 and 15 respectively


  • 3 and 14 respectively


  • 4 and 14 respectively


  • 3 and 15 respectively

Question 3

The postorder traversal of a binary tree is 8, 9, 6, 7, 4, 5, 2, 3, 1. The inorder traversal of the same tree is 8, 6, 9, 4, 7, 2, 5, 1, 3. The height of a tree is the length of the longest path from the root to any leaf. The height of the binary tree above is ________ . 2018 NAT || 1-mark

  • 4

Question 4

Let T be a full binary tree with 8 leaves. (A full binary tree has every level full.) Suppose two leaves a and b of T are chosen uniformly and independently at random. The expected value of the distance between a and b in T (i.e., the number of edges in the unique path between a and b) is (rounded off to 2 decimal places) ___________ 2019 NAT || 2-mark

  • 4.24- 4.26

Question 5

In a balanced binary search tree with n elements, what is the worst case time complexity of reporting all elements in range [a,b]? Assume that the number of reported elements is k. 2020 MCQ || 1-mark

  • Θ(n log k)

  • Θ(log n + k)

  • Θ(k log n)

  • Θ(log n)


Question 6

What is the worst case time complexity of inserting n2 elements into an AVL-tree with n elements initially? 2020 MCQ || 1-mark


  • Θ(n4)

  • Θ(n2)


  • Θ(n3)

  • Θ(n2 log n)


Question 7

The preorder traversal of a binary search tree is 15, 10, 12, 11, 20, 18, 16, 19.

Which one of the following is the postorder traversal of the tree? 2020 MCQ || 2-mark


  • 20, 19, 18, 16, 15, 12, 11, 10


  • 11, 12, 10, 16, 19, 18, 20, 15


  • 10, 11, 12, 15, 16, 18, 19, 20

  •  19, 16, 18, 20, 11, 12, 10, 15


Question 8

An articulation point in a connected graph is a vertex such that removing the vertex and its incident edges disconnects the graph into two or more connected components. Let T be a DFS three obtained by doing DFS in a connected undirected graph G.

Which of the following options is/are correct?


2021 SET 1 || MCQ || 1-mark


  • Root of T is an articulation point in G if and only if it has 2 or more children.


  • A leaf of T can be an articulation point in G.

  • Root of T can never be an articulation point in G.

  • If u is an articulation point in G such that x is an ancestor of u in T and y is a descendent of u in T, then all paths from x to y in G must pass through u.

Question 9

A binary search T contains n distinct elements. What is the time complexity of picking an element in T that is smaller than the maximum element in T?

2021 SET 1 || MCQ || 1-mark

  •  Θ(n)

  • Θ(log n)


  • Θ(n log n)

  • Θ(1)


Question 10

Consider a complete binary tree with 7 nodes. Let A denote the set of first 3 elements obtained by performing Breadth-First Search (BFS) starting from the root. Let B denote the set of first 3 elements obtained by performing Depth-First Search (DFS) starting from the root.

The value of |A – B| is _________

2021 set 2 || NAT || 1-mark

  • 1

There are 43 questions to complete.

Take a part in the ongoing discussion