Recent questions tagged goclasses-da-dpp

4 4 votes
1 1 answer
194
194 views
Consider the following min-heap where each node is written as $\texttt{(value, priority)}$:Now perform these operations in order:$\texttt{updatePriority(A, 8)}$ $\texttt{...
4 4 votes
1 1 answer
182
182 views
Start with the min-heap obtained after inserting:$$10, 12, 1, 14, 6, 5, 8, 15, 3, 9$$The heap array is:$$[1, 3, 5, 6, 9, 10, 8, 15, 14, 12]$$Now perform three $\texttt{De...
7 7 votes
1 1 answer
187
187 views
Insert the following values one by one into an initially empty minimum binary heap:$$10, 12, 1, 14, 6, 5, 8, 15, 3, 9$$What is the final heap array in level-order?$[1, 3,...
6 6 votes
1 1 answer
241
241 views
During heap sort, the array looks like this:$J = [7, 3, 6, 2, 1, 4, 5, 8, 9]$Assume heap sort is using a max-heap to sort the array in increasing order.How many elements ...
5 5 votes
1 1 answer
206
206 views
A max-heap is stored using $0$-based indexing as:$$[60, 30, 45, 15, 5, 10, 20]$$During the first iteration of heap sort:Swap the root with the last element. Reduce the he...
6 6 votes
2 2 answers
199
199 views
A min-heap is stored using $1$-based indexing as:$[2, 13, 7, 17, 14, 22, 8, 21]$After one $\texttt{DeleteMin}$ operation, what is the final heap array?$[7, 13, 8, 17, 14,...
5 5 votes
2 2 answers
207
207 views
The following max-heap is stored using $1$-based indexing:$[57, 53, 42, 48, 25, 34, 29, 18, 30, 25]$Insert $55$ into this max-heap. What is the final heap array?$[57, 55,...
7 7 votes
1 1 answer
190
190 views
Consider the following binary min-heap:Perform the following operations in order:$\text{DeleteMin}$ $\text{Insert 8}$ $\text{Insert 2}$ What is the final array representa...
7 7 votes
1 1 answer
221
221 views
Which formula is the best approximation for the depth of a heap with $n$ nodes?$\log_2 n$ The number of digits in $n$ in base $10$ $\sqrt n$ $n^2$
3 3 votes
1 1 answer
184
184 views
A priority queue is implemented using a max-heap. During reheapification downward, the out-of-place node has priority $42$.The surrounding priorities are:Parent priority:...
6 6 votes
1 1 answer
238
238 views
What feature of heaps allows them to be efficiently implemented using a partially filled array?Heaps are binary search trees Heaps are complete binary trees Heaps are ful...
7 7 votes
1 1 answer
190
190 views
A binary heap is stored in an array using $\textbf{1}$-based indexing. If a node is stored at location $i$ and it has two children, where is its left child stored?$\left\...
5 5 votes
2 2 answers
282
282 views
A key consists of three uppercase English letters. The hash value $h$ of a key is calculated as:$h = (\text{sum of alphabetical positions of the three letters}) \bmod 27$...
7 7 votes
3 3 answers
283
283 views
A hash table has size $10$. Each key is a lowercase English alphabet character from $a$ to $z$.The hash value of a key is defined as the last digit of its decimal ASCII c...
4 4 votes
3 3 answers
238
238 views
Which of the following factors affect the average search length in hashing?Load factor Hash function Collision resolution method Only I and II Only I and III Only II and ...
4 4 votes
2 2 answers
212
212 views
A hash table of length $11$ is initially empty. The hash function is:$H(key) = key \bmod 7$Collisions are resolved using linear probing.The following keys are inserted in...
5 5 votes
3 3 answers
335
335 views
A hash table of length $11$ is initially empty. The hash function is:$H(key) = (key \times 3) \bmod 11$Collisions are resolved using quadratic probing:$H_k = (H_0 + k^2) ...
3 3 votes
1 1 answer
222
222 views
The following hexadecimal data items are inserted into a hash table in the given order:$\text{1A, ~35, ~3B, ~54, ~8E, ~A1, ~AF, ~B2, ~B3}$The hash value is computed usin...
3 3 votes
1 1 answer
173
173 views
A hash table $\texttt{hashArray}$ has $5$ positions, indexed from $1$ to $5$. Initially,$\texttt{hashArray = \{-1, -1, -1, -1, -1\}}$The value $\texttt{-1}$ means that th...
4 4 votes
1 1 answer
169
169 views
Which of the following are open addressing approaches for resolving collisions in a hash table?Linear probing Quadratic probing Exponential hashing Separate chaining
3 3 votes
1 1 answer
183
183 views
A hash table uses open addressing with linear probing. Suppose a key is deleted from the table.Why should we not simply replace the deleted key’s slot by $\text{NULL}$?Be...
3 3 votes
1 1 answer
176
176 views
A hash table of size $5$ uses open addressing with linear probing.The probing function is:$H(k,i) = (k+i) \bmod 5$where $i$ is the collision count.Insert the keys in the ...
2 2 votes
1 1 answer
213
213 views
Consider the following statements about hash tables.$\text{S1}:$ The worst-case complexity of checking whether an object is present in a hash set is $O(1)$.$\text{S2}:$ T...
3 3 votes
1 1 answer
214
214 views
A hash table has $m$ slots and stores $n$ keys. Assume simple uniform hashing. Collisions are resolved by chaining.What is the expected number of slots that end up non-em...
3 3 votes
1 1 answer
197
197 views
A hash table has $m$ slots and stores $n$ keys. Assume simple uniform hashing, so each key is equally likely to hash into any slot, independently of other keys. Collision...
2 2 votes
1 1 answer
198
198 views
For the keys : $\text{47, 61, 36, 52, 56, 33, 92}$Suppose the hash function is :$h(k) = ((10k + 4) \bmod c) \bmod 7$where $c$ is a positive integer.What is the smallest v...
4 4 votes
2 2 answers
247
247 views
Insert the integer keys$47, 61, 36, 52, 56, 33, 92$in the given order into a hash table of size $7$.The hash function is:$h(k) = (10k + 4) \bmod 7$Collisions are resolved...
6 6 votes
2 2 answers
321
321 views
In a binary tree $T$, nodes $p$, $q$, and $v$ appear in the inorder traversal as:$\ldots, p, v, q, \ldots$Node $v$ has both a left child and a right child.Which of the fo...
4 4 votes
2 2 answers
253
253 views
A Binary Search Tree has $15$ nodes. Every node except those at the lowest level has both a left child and a right child.A key is searched in this BST. The key may or may...