# Recent questions tagged data-structures

1
The height of a binary tree is the maximum number of edges in any root to leaf path. The maximum number number of nodes in a binary tree of height $h$ is $2^{h}$ $2^{h-1} – 1$ $2^{h+1} – 1$ $2^{h+1}$
2
Which of the following is useful in traversing a given graph by breadth first search? Stack Set List Queue
3
If queue is implemented using arrays, what would be the worst run time complexity of queue and dequeue operations? $O(n),O(n)$ $O(n),O(1)$ $O(1),O(n)$ $O(1),O(1)$
4
The number of possible binary trees with $4$ nodes is $12$ $13$ $14$ $15$
5
A binary search tree contains the values-$1,2,3,4,5,6,7$ and $8.$ The tree is traversed in preorder and the values are printed out. Which of the following sequences is a valid output? $5\;\;3\;\;1\;\;2\;\;4\;\;7\;\;8\;\;6\;\;$ $5\;\;3\;\;1\;\;2\;\;6\;\;4\;\;9\;\;7$ $5\;\;3\;\;2\;\;4\;\;1\;\;6\;\;7\;\;8$ $5\;\;3\;\;1\;\;2\;\;4\;\;7\;\;6\;\;8$
6
In binary search tree which traversal is used for getting ascending order values ? Inorder Preorder Postorder None of the options
7
In a full binary tree number of nodes is $63$ then the height of the tree is : $2$ $4$ $3$ $6$
1 vote
8
The address field of linked list : Contain address of next node May contain null character Contain address of next pointer Both $\left (A \right)$ and $\left ( B \right)$
1 vote
9
The expression $5-2-3^{*} – 2$ will evaluate to $18$, if : $‘ – ‘$ is left associative and $‘*‘$ has precedence over $‘ – ‘$ $‘ – ‘$ is right associative and $‘*‘$ has precedence over $‘ – ‘$ $‘ – ‘$ is right associative and $‘ – ‘$ has precedence over $‘*‘$ $‘ – ‘$ is left associative and $‘ – ‘$ has precedence over $‘*‘$
10
The number of unused pointers in a complete binary tree of depth $5$ is: $4$ $8$ $16$ $32$
1 vote
11
A ________ is a linear list in which insertions and deletions are made to from either end of the structure. Circular queue. Priority queue. Stack. Dequeue.
12
The recurrence relation capturing the optimal execution time of the Towers of Hanoi problem with $n$ discs is: $T(n)=2T(n-2)+2$ $T(n)=2T(n/2)+1$ $T(n)=2T(n-1)+n$ $T(n)=2T(n-1)+1$
13
Which of the following is the correct order of evaluation for the below expression? $z=x+y^*z/4\%2-1$ $^*/\%+-=$ $=^*/\%+-$ $/^*\%-+=$ $^*\% /-+=$
1 vote
14
What data structures is used for depth first traversal of a graph? Queue Stack List None of the above
1 vote
15
In the ________ traversal we process all of a vertex's descendants before we move to an adjacent vertex. Depth First Breadth First Width First Depth Limited
16
What are the appropriate data structures for graph traversal using Breadth First Search(BFS) and Depth First Search(DFS) algorithms? Stack for BFS and Queue for DFS Queue for BFS and Stack for DFS Stack for BFS and Stack for DFS Queue for BFS and Queue for DFS
1 vote
17
A recursive function $h$, is defined as follows: $\begin{array} {} h(m) & =k, \text{if } m=0 \\ &=1, \text{if } m=1 \\ &= 2 h(m-1)+4h(m-2), \text{if } m \geq 2 \end{array}$ If the value of $h(4)$ is $88$ then the value of $k$ is: $0$ $1$ $2$ $-1$
18
Let $C$ be a binary linear code with minimum distance $2t+1$ then it can correct upto _______ bits of error $t+1$ $t$ $t-2$ $\frac{t}{2}$
19
The seven elements $A, B, C, D, E,F$ and $G$ are pushed onto a stack in reverse order, i.e., starting from $G$. The stack is popped five times and each element is inserted into a queue. Two elements are deleted from the queue and pushed back onto the stack. Now, one element is popped from the stack. The popped item is ___________. $A$ $B$ $F$ $G$
20
Which of the following is a valid heap? $a$ $b$ $c$ $d$
1 vote
21
If $h$ is chosen from a universal collection of hash functions and is used to hash $n$ keys into a table of size $m$, where $n \leq m$, the expected number of collisions involving a particular key $x$ is less than __________. $1$ $1/n$ $1/m$ $n/m$
22
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$. $\Theta (\log n)$ $\Theta (\log n +k)$ $\Theta (k \log n)$ $\Theta ( n \log k)$
23
Consider a $2$-dimensional array $x$ with $10$ rows and $4$ columns, with each element storing a value equivalent to the product of row number and column number. The array is stored in row-major format. If the first element $x[0][0]$ occupies the memory location with ... location, which all locations (in decimal) will be holding a value of $10$? $1018,1019$ $1022,1041$ $1013,1014$ $1000,1399$
1 vote
24
$G$ is an undirected graph with vertex set $\{v1, \ v2, \ v3, \ v4, \ v5, \ v6, \ v7\}$ and edge set $\{v1v2,\ v1v3,\ v1v4\ ,v2v4,\ v2v5,\ v3v4,\ v4v5,\ v4v6,\ v5v6,\ v6v7\ \}$. A breadth first search of the graph is performed with $v1$ as the root node. Which of the following is a tree edge? $v2v4$ $v1v4$ $v4v5$ $v3v4$
25
Of the following, which best approximates the ratio of the number of nonterminal nodes in the total number of nodes in a complete $K$-ary tree of depth $N$ ? $1/N$ $N-1/N$ $1/K$ $K-1/K$
26
Convert the pre-fix expression to in-fix $- ^{\ast} +ABC^{\ast} – DE+FG$ $(A-B)^{\ast}C+(D^{\ast}E)-(F+G)$ $(A+B)^{\ast}C-(D-E)^{\ast}(F-G)$ $(A+B-C)^{\ast}(D-E)^{\ast}(F+G)$ $(A+B)^{\ast}C-(D^{\ast}E)-(F+G)$
27
The minimum height of an AVL tree with $n$ nodes is $\text{Ceil } (\log_2(n+1))$ $1.44\ \log_2n$ $\text{Floor } (\log_2(n+1))$ $1.64\ \log_2n$
What is the in-order successor of $15$ in the given binary search tree? $18$ $6$ $17$ $20$
A stack is implemented with an array of $'A[0...N-1]'$ and a variable $pos$'. The push and pop operations are defined by the following code. push (x) A[pos] <- x pos <- pos -1 end push pop() pos <- pos+1 return A[pos] end pop Which of the ... initialize an empty stack with capacity $N$ for the above implementation $pos \leftarrow -1$ $pos\leftarrow 0$ $pos\leftarrow 1$ $pos\leftarrow N-1$
In linear hashing, if blocking factor $bfr$, loading factor $i$ and file buckets $N$ are known, the number of records will be $cr= i+bfr+N$ $r=i-bfr-N$ $r=i+bfr-N$ $r=i ^{\ast} bfr ^{\ast} N$