search
Log In

Recent questions tagged data-structures

1 vote
2 answers
1
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 200 views
0 votes
2 answers
2
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 62 views
0 votes
2 answers
3
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 152 views
0 votes
6 answers
4
Which of the following is a valid heap? $a$ $b$ $c$ $d$
asked Mar 24 in DS jothee 103 views
1 vote
3 answers
5
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 119 views
6 votes
4 answers
6
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 2.4k views
2 votes
5 answers
7
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.1k views
1 vote
3 answers
8
$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 543 views
3 votes
3 answers
9
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 544 views
2 votes
2 answers
10
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 351 views
2 votes
4 answers
11
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 828 views
3 votes
3 answers
12
What is the in-order successor of $15$ in the given binary search tree? $18$ $6$ $17$ $20$
asked Jan 13 in DS Satbir 232 views
2 votes
3 answers
13
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 342 views
1 vote
2 answers
14
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 369 views
2 votes
4 answers
15
The post-order traversal of binary tree is $ACEDBHIGF$. The pre-order traversal is $\text{A B C D E F G H I}$ $\text{F B A D C E G I H}$ $\text{F A B C D E G H I}$ $\text{A B D C E F G I H}$
asked Jan 13 in DS Satbir 698 views
5 votes
3 answers
16
Suppose that the figure to the right is a binary search tree. The letters indicate the names of the nodes, not the values that are stored. What is the predecessor node, in terms of value, of the root node $A?$ $D$ $H$ $I$ $M$
asked Sep 13, 2019 in DS gatecse 237 views
2 votes
2 answers
17
A First In First Out queue is a data structure supporting the operation Enque, Deque, Print, Enque(x) adds the item $x$ to the tail of the queue. Deque removes the element at the head of the queue and returns its value. Print prints the head of the queue. You ... in reverse order. If the queue had $n$ elements to begin with, how many statements would you need to print the queue in reverse order?
asked Sep 13, 2019 in DS gatecse 196 views
0 votes
0 answers
18
Explain how to implement doubly linked lists using only one pointer value $x.np$ per item instead of the usual two (next and prev). Assume that all pointer values can be interpreted as $k$-bit integers, and define $x.np$ to be $x.np=x.next$ $XOR$ $x.prev$, the $k$- ... to implement the $SEARCH$, $INSERT$, and $DELETE$ operations on such a list. Also, show how to reverse such a list in $O(1)$ time.
asked Jun 30, 2019 in Algorithms akash.dinkar12 169 views
0 votes
1 answer
19
Give a $\Theta(n)$ time nonrecursive procedure that reverses a singly linked list of $n$ elements. The procedure should use no more than constant storage beyond that needed for the list itself.
asked Jun 30, 2019 in Algorithms akash.dinkar12 96 views
0 votes
1 answer
20
The dynamic-set operation $UNION$ takes two disjoint sets $S_1$ and $S_2$ as input, and it returns a set $S=S_1 \cup S_2$ consisting of all the elements of $S_1$ and $S_2$.The sets $S_1$ and $S_2$ are usually destroyed by the operation. Show how to support $UNION$ in $O(1)$ time using a suitable list data structure.
asked Jun 30, 2019 in Algorithms akash.dinkar12 56 views
0 votes
0 answers
21
Implement the dictionary operations $INSERT$, $DELETE$, and $SEARCH$ using singly linked, circular lists. What are the running times of your procedures?
asked Jun 30, 2019 in Algorithms akash.dinkar12 72 views
0 votes
0 answers
22
LIST-SEARCH’(L, k) 1 x = L.nil.next 2 while x != L.nil and x.key != k 3 x = x.next 4 return x As written, each loop iteration in the LIST-SEARCH’ procedure requires two tests: one for $x\neq L.nil$ and one for $x.key\neq k$. Show how to eliminate the test for $x\neq L.nil$ in each iteration.
asked Jun 30, 2019 in Algorithms akash.dinkar12 41 views
0 votes
2 answers
23
0 votes
1 answer
24
0 votes
0 answers
25
2 votes
2 answers
26
0 votes
1 answer
27
0 votes
1 answer
28
Whereas a stack allows insertion and deletion of elements at only one end, and a queue allows insertion at one end and deletion at the other end, a deque (double ended queue) allows insertion and deletion at both ends. Write four $O(1)$ time procedures to insert elements into and delete elements from both ends of a deque implemented by an array.
asked Jun 28, 2019 in Algorithms akash.dinkar12 104 views
0 votes
0 answers
29
0 votes
1 answer
30
ENQUEUE(Q, x) 1 Q[Q.tail] = x 2 if Q.tail == Q.length 3 Q.tail = 1 4 else Q.tail = Q.tail + 1 DEQUEUE(Q) 1 x = Q[Q.head] 2 if Q.head == Q.length 3 Q.head = 1 4 else Q.head = Q.head + 1 5 return x illustrate the result of each operation in the sequence ENQUEUE(Q,4),ENQUEUE(Q,1),ENQUEUE(Q,3),DEQUEUE(Q),ENQUEUE(Q,8),DEQUEUE(Q) on an initially empty queue $Q$ stored in array $Q[1...6]$.
asked Jun 28, 2019 in Algorithms akash.dinkar12 88 views
...