Recent questions tagged data-structures

31 31 votes
3 answers 3 answers
9.9k
9.9k views
A program attempts to generate as many permutations as possible of the string, '$abcd$' by pushing the characters $a, b, c, d$ in the same order onto a stack, but it may ...
85 85 votes
9 answers 9 answers
41.4k
41.4k views
Let $P$ be a singly linked list. Let $Q$ be the pointer to an intermediate node $x$ in the list. What is the worst-case time complexity of the best-known algorithm to del...
58 58 votes
3 answers 3 answers
17.0k
17.0k views
An array $X$ of n distinct integers is interpreted as a complete binary tree. The index of the first element of the array is $0$. If the root node is at level $0$, the le...
52 52 votes
3 answers 3 answers
14.4k
14.4k views
An array $X$ of $n$ distinct integers is interpreted as a complete binary tree. The index of the first element of the array is $0$. If only the root node does not satisfy...
64 64 votes
6 answers 6 answers
21.8k
21.8k views
An array $X$ of $n$ distinct integers is interpreted as a complete binary tree. The index of the first element of the array is $0$. The index of the parent of element $X[...
38 38 votes
6 answers 6 answers
26.7k
26.7k views
Suppose that we have numbers between $1$ and $100$ in a binary search tree and want to search for the number $55$. Which of the following sequences CANNOT be the sequence...
25 25 votes
1 answers 1 answer
9.7k
9.7k views
Which of the following sequences of array elements forms a heap?$\{23, 17, 14, 6, 13, 10, 1, 12, 7, 5\}$$\{23, 17, 14, 6, 13, 10, 1, 5, 7, 12\}$$\{23, 17, 14, 7, 13, 10, ...
36 36 votes
6 answers 6 answers
18.0k
18.0k views
Which of the following statement(s) is TRUE?A hash function takes a message of arbitrary length and generates a fixed length code.A hash function takes a message of fixed...
77 77 votes
14 answers 14 answers
39.4k
39.4k views
In a binary tree, the number of internal nodes of degree $1$ is $5$, and the number of internal nodes of degree $2$ is $10$. The number of leaf nodes in the binary tree i...
52 52 votes
11 answers 11 answers
25.1k
25.1k views
Suppose you are given an implementation of a queue of integers. The operations that can be performed on the queue are:$\text{isEmpty (Q)}$ — returns true if the queue is ...
260 260 votes
19 answers 19 answers
62.3k
62.3k views
When searching for the key value $60$ in a binary search tree, nodes containing the key values $10, 20, 40, 50, 70, 80, 90$ are traversed, not necessarily in the order gi...
105 105 votes
13 answers 13 answers
47.3k
47.3k views
Consider a hash function that distributes keys uniformly. The hash table size is $20$. After hashing of how many keys will the probability that any new key hashed collide...
96 96 votes
8 answers 8 answers
26.6k
26.6k views
A binary tree with $n 1$ nodes has $n_1$, $n_2$ and $n_3$ nodes of degree one, two and three respec­tively. The degree of a node is defined as the number of its neighbou...
70 70 votes
8 answers 8 answers
30.4k
30.4k views
A binary tree with $n 1$ nodes has $n_1$, $n_2$ and $n_3$ nodes of degree one, two and three respec­tively. The degree of a node is defined as the number of its neighbou...
39 39 votes
4 answers 4 answers
19.3k
19.3k views
How many distinct BSTs can be constructed with $3$ distinct keys?$4$$5$$6$$9$
46 46 votes
3 answers 3 answers
11.2k
11.2k views
A Binary Search Tree (BST) stores values in the range $37$ to $573$. Consider the following sequence of keys.$81, 537, 102, 439, 285, 376, 305$$52, 97, 121, 195, 242, 381...
78 78 votes
4 answers 4 answers
24.4k
24.4k views
A Binary Search Tree (BST) stores values in the range $37$ to $573$. Consider the following sequence of keys.$81, 537, 102, 439, 285, 376, 305$$52, 97, 121, 195, 242, 381...
24 24 votes
4 answers 4 answers
9.3k
9.3k views
Consider a hash table of size $11$ that uses open addressing with linear probing. Let $h(k) = k \mod 11$ be the hash function used. A sequence of records with keys$43 \ 3...
30 30 votes
5 answers 5 answers
12.0k
12.0k views
The following three are known to be the preorder, inorder and postorder sequences of a binary tree. But it is not known which is which.$MBCAFHPYK$$KAMCBYPFH$$MABCKYFPH$Pi...
45 45 votes
4 answers 4 answers
19.8k
19.8k views
Which of the following is TRUE?The cost of searching an AVL tree is $\Theta (\log n)$ but that of a binary search tree is $O(n)$The cost of searching an AVL tree is $\The...
32 32 votes
5 answers 5 answers
12.5k
12.5k views
Insert the characters of the string $K \ R \ P \ C \ S \ N \ Y \ T \ J \ M$ into a hash table of size $10$.Use the hash function$$h(x)=( ord (x) – ord (\text{“}a\text{”}...
72 72 votes
10 answers 10 answers
33.0k
33.0k views
A binary search tree is used to locate the number $43$. Which of the following probe sequences are possible and which are not? Explain.$\begin{array}{llllll} \text{(a)} ...
36 36 votes
6 answers 6 answers
37.1k
37.1k views
A binary search tree is generated by inserting in order the following integers:$$50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24$$The number of nodes in the left subtree and ...
40 40 votes
3 answers 3 answers
20.5k
20.5k views
The minimum number of interchanges needed to convert the array into a max-heap is$89, 19, 40, 17, 12, 10, 2, 5, 7, 11, 6, 9, 70$$0$$1$$2$$3$
27 27 votes
3 answers 3 answers
7.1k
7.1k views
Which of the following sequences denotes the post order traversal sequence of the below tree?$f\; e\; g\; c\; d\; b\; a$$g\; c\; b\; d\; a\; f\; e$$g\; c\; d\; b\; f\; e\...
38 38 votes
3 answers 3 answers
17.7k
17.7k views
In the balanced binary tree in the below figure, how many nodes will become unbalanced when a node is inserted as a child of the node “g”?$1$$3$$7$$8$
54 54 votes
9 answers 9 answers
23.7k
23.7k views
An advantage of chained hash table (external hashing) over the open addressing scheme isWorst case complexity of search operations is lessSpace used is lessDeletion is ea...
52 52 votes
7 answers 7 answers
25.1k
25.1k views
Consider the following statements:First-in-first out types of computations are efficiently supported by STACKS.Implementing LISTS on linked lists is more efficient than i...
35 35 votes
4 answers 4 answers
7.0k
7.0k views
What is the number of binary trees with $3$ nodes which when traversed in post-order give the sequence $A, B, C ?$ Draw all these binary trees.