Recent questions tagged data-structures

0 0 votes
0 0 answers
94
94 views
Given a square matrix of size n*n, elements are either 0 or 1. Suggest an algorithm tofind the sub-rectangle made of 1 , with largest area. (Find the area).
38 38 votes
2 answers 2 answers
9.6k
9.6k views
Consider any array representation of an $n$ element binary heap where the elements are stored from index $1$ to index $n$ of the array. For the element stored at index $i...
29 29 votes
3 answers 3 answers
8.9k
8.9k views
Suppose you are given arrays $p [1......N]$ and $q [1......N]$ both uninitialized, that is, each location may contain an arbitrary value), and a variable count, initiali...
38 38 votes
2 answers 2 answers
9.6k
9.6k views
Suppose a stack implementation supports, in addition to PUSH and POP, an operation REVERSE, which reverses the order of the elements on the stack.To implement a queue usi...
69 69 votes
6 answers 6 answers
26.7k
26.7k views
Let LASTPOST, LASTIN and LASTPRE denote the last vertex visited in a postorder, inorder and preorder traversal respectively, of a complete binary tree. Which of the foll...
45 45 votes
11 answers 11 answers
17.9k
17.9k views
Consider the following nested representation of binary trees: $(X \ Y \ Z)$ indicates $Y$ and $Z$ are the left and right subtrees, respectively, of node $X$. Note that $Y...
74 74 votes
15 answers 15 answers
18.4k
18.4k views
An $n \times n$ array $v$ is defined as follows:$v\left[i,j\right] = i - j$ for all $i, j, i \leq n, 1 \leq j \leq n$The sum of the elements of the array $v$ is$0$$n-1$$n...
32 32 votes
3 3 answers
8.2k
8.2k views
Suggest a data structure for representing a subset $S$ of integers from $1$ to $n$. Following operations on the set $S$ are to be performed in constant time (independent ...
39 39 votes
5 answers 5 answers
14.5k
14.5k views
A $2-3$ tree is such thatAll internal nodes have either $2$ or $3$ childrenAll paths from root to the leaves have the same lengthThe number of internal nodes of a $2-3$ t...
31 31 votes
5 answers 5 answers
8.6k
8.6k views
Consider the binary tree in the figure below:What structure is represented by the binary tree?
31 31 votes
6 answers 6 answers
7.6k
7.6k views
The following sequence of operations is performed on a stack:$PUSH (10), PUSH (20), POP, PUSH (10), PUSH (20), POP, POP, POP, PUSH (20), POP$The sequence of values poppe...
60 60 votes
2 answers 2 answers
18.6k
18.6k views
The weighted external path length of the binary tree in figure is ______
26 26 votes
8 answers 8 answers
9.6k
9.6k views
If the binary tree in figure is traversed in inorder, then the order in which the nodes will be visited is ______
56 56 votes
7 answers 7 answers
27.3k
27.3k views
The following C function takes a single-linked list of integers as a parameter and rearranges the elements of the list. The function is called with the list containing th...
190 190 votes
7 answers 7 answers
60.5k
60.5k views
You are given the postorder traversal, $P$, of a binary search tree on the $n$ elements $1, 2, \dots, n$. You have to determine the unique binary search tree that has $P...
116 116 votes
12 answers 12 answers
47.8k
47.8k views
Consider the following operation along with Enqueue and Dequeue operations on queues, where $k$ is a global parameter.MultiDequeue(Q){ m = k while (Q is not empty) and (m...
70 70 votes
5 answers 5 answers
23.8k
23.8k views
The worst case running time to search for an element in a balanced binary search tree with $n2^{n}$ elements is$\Theta(n\log n)$$\Theta(n2^n)$$\Theta(n)$$\Theta(\log n)$