search
Log In

Recent questions tagged data-structures

0 votes
1 answer
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}$
asked Apr 1 in DS Lakshman Patel RJIT 222 views
0 votes
2 answers
2
0 votes
1 answer
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)$
asked Apr 1 in DS Lakshman Patel RJIT 118 views
0 votes
0 answers
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$
asked Apr 1 in DS Lakshman Patel RJIT 119 views
0 votes
2 answers
6
0 votes
2 answers
7
1 vote
1 answer
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)$
asked Mar 31 in DS Lakshman Patel RJIT 254 views
1 vote
1 answer
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 $‘*‘$
asked Mar 31 in DS Lakshman Patel RJIT 131 views
2 votes
1 answer
10
1 vote
4 answers
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.
asked Mar 31 in DS Lakshman Patel RJIT 262 views
0 votes
1 answer
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$
asked Mar 31 in DS Lakshman Patel RJIT 167 views
0 votes
2 answers
13
1 vote
1 answer
14
1 vote
2 answers
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
asked Mar 31 in DS Lakshman Patel RJIT 235 views
0 votes
1 answer
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
asked Mar 30 in DS Lakshman Patel RJIT 95 views
1 vote
3 answers
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$
asked Mar 24 in DS jothee 306 views
0 votes
2 answers
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}$
asked Mar 24 in DS jothee 90 views
0 votes
2 answers
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$
asked Mar 24 in DS jothee 241 views
0 votes
6 answers
20
Which of the following is a valid heap? $a$ $b$ $c$ $d$
asked Mar 24 in DS jothee 183 views
1 vote
4 answers
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$
asked Mar 24 in DS jothee 213 views
6 votes
4 answers
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)$
asked Feb 12 in DS Arjun 3.4k views
3 votes
5 answers
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$
asked Jan 13 in DS Satbir 1.6k views
1 vote
3 answers
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$
asked Jan 13 in DS Satbir 672 views
3 votes
3 answers
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$
asked Jan 13 in DS Satbir 720 views
2 votes
2 answers
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)$
asked Jan 13 in DS Satbir 450 views
3 votes
4 answers
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$
asked Jan 13 in DS Satbir 1k views
3 votes
3 answers
28
What is the in-order successor of $15$ in the given binary search tree? $18$ $6$ $17$ $20$
asked Jan 13 in DS Satbir 292 views
2 votes
3 answers
29
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$
asked Jan 13 in DS Satbir 446 views
1 vote
2 answers
30
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$
asked Jan 13 in DS Satbir 475 views
...