info@digitalbithub.com
DigitalBitHubLearn

Programming & Data Structure

Previous Year Questions
Gate CSGate CS 2022 | Question - 16 | Programming & Data Structure

Suppose we are given n keys, m hash table slots, and two simple uniform hash functions h1 and h2. Further suppose our hashing scheme uses h1 for the odd keys and h2 for the even keys. What is the expected number of keys in a slot?

Gate CSGate CS 2022 | Question - 21 | Programming & Data Structure

What is printed by the following ANSI C program? #includestdio.hint main(int argc, char *argv[]){ int x = 1, z[2] = {10, 11}; int *p = NULL; p = x; *p = 10; p = z[1]; *(z[0] + 1) += 3; printf("%d, %d, %d\n", x, z[0], z[1]); return 0;}

Gate CSGate CS 2022 | Question - 28 | Programming & Data Structure

Suppose a binary search tree with 1000 distinct elements is also a complete binary tree. The tree is stored using the array representation of binary heap trees. Assuming that the array indices start with 0, the 3rd largest element of the tree is stored at index_____________.

Gate CSGate CS 2020 | Question - 5 | Programming & Data Structure

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?

Gate CSGate CS 2020 | Question - 6 | Programming & Data Structure

What is the worst case time complexity of inserting n elements into an AVL-tree with n elements initially?

Gate CSGate CS 2020 | Question - 41 | Programming & Data Structure

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

Gate CSGate CS 2020 | Question - 46 | Programming & Data Structure

Consider the following C functions. int fun1 (int n) { static int i = 0; if (n 0) { ++i; fun1 (n-1); } return (i);} int fun2 (int n) { static int i = 0; if (n 0) { i = i + fun1 (n); fun2 (n-1); } return (i);} The return value of fun2(5) is _____.

Gate CSGate CS 2020 | Question - 48 | Programming & Data Structure

Consider the following C functions. int tob (int b, int* arr){ int i; for (i=0; b0; i++) { if (b%2) arr[i]=1; elsearr[i]=0; b = b/2; } return (i);} int pp(int a, int b) { int arr[20]; int i, tot = 1, ex, len; ex = a; len = tob(b, arr); for (i = 0; i len; i++) { if(arr[i] == 1) tot = tot * ex; ex = ex * ex; } return (tot);} The value returned by pp(3,4) is ______.

Related Topics