Recent questions and answers in DS

28.7k
views
12 answers
75 votes
In a compact single dimensional array representation for lower triangular matrices (i.e all the elements above the diagonal are zero) of size $n \times n$, non-zero eleme...
5.2k
views
3 answers
26 votes
The following Pascal program segments finds the largest number in a two-dimensional integer array $A[0\dots n-1, 0\dots n-1]$ using a single loop. Fill up the boxes to co...
235
views
1 answers
1 votes
Consider an integer upper triangular 2D array arr[–8 to +7][–8 to +7] having base address 1000. If the size of the integer is 4 bytes, the address of the element pres...
9.7k
views
5 answers
19 votes
Consider the problem of reversing a singly linked list. To take an example, given the linked list below,the reversed linked list should look likeWhich one of the followin...
107
views
0 answers
0 votes
The array-based stack throws an exception when the array’s capacity has been reached. Consider the following alternative : create a larger array, using the resize metho...
17.7k
views
5 answers
67 votes
A scheme for storing binary trees in an array $X$ is as follows. Indexing of $X$ starts at $1$ instead of $0$. the root is stored at $X $. For a node stored at $X[i]$, th...
1.0k
views
1 answers
3 votes
Consider a perfect binary tree with $\mathrm{n}$ nodes and $\mathrm{h}$ height. A tree is perfect when all levels of the tree are completely full. Let root is at depth $0...
609
views
2 answers
1 votes
Five items $\text{A, B, C, D, E}$ are pushed onto a stack, one after other starting from item $\mathrm{A}$. The stack is then popped by three items, and each item is inse...
316
views
2 answers
1 votes
If the maximum height of a binary tree is $\mathrm{N},$ then how many number of nodes will there be?
1.8k
views
3 answers
1 votes
Suppose we are implementing quadratic probing with a Hash function, Hash $(y)=X$ mode $100$. If an element with key $4594$ is inserted and the first three locations attem...
372
views
1 answers
1 votes
Provide the correct data structures for the following:Asynchronous data transfer and accessing shared resource involve _________.
997
views
2 answers
1 votes
​​​​​Let $H, I, L$, and $N$ represent height, number of internal nodes, number of leaf nodes, and the total number of nodes respectively in a rooted binary tree...
7.6k
views
2 answers
24 votes
Statement for Linked Answer Questions 76 & 77:A $3$-ary max heap is like a binary max heap, but instead of $2$ children, nodes have $3$ children. A $3$-ary heap can be re...
2.9k
views
2 answers
0 votes
Consider a binary min-heap containing $105$ distinct elements. Let $k$ be the index (in the underlying array) of the maximum element stored in the heap. The number of pos...
943
views
1 answers
1 votes
​​​​​​Consider performing uniform hashing on an open address hash table with load factor $\alpha=\frac{n}{m}<1$, where $n$ elements are stored in the table wi...
892
views
2 answers
0 votes
​​​​​​Match the items in Column $1$ with the items in Column $2$ in the following table:\begin{array}{|ll|ll|}\hline & \text{Column 1} & & \text{Column 2} \\\...
2.4k
views
1 answers
1 votes
​​​​​Let $\mathrm{S} 1$ and $\mathrm{S} 2$ be two stacks. $\mathrm{S} 1$ has capacity of $4$ elements. $\mathrm{S} 2$ has capacity of $2$ elements. $\text{S1}$ ...
1.2k
views
1 answers
0 votes
​​​​​​Consider the following tree traversals on a full binary tree:PreorderInorderPostorderWhich of the following traversal options is/are sufficient to uniqu...
814
views
1 answers
0 votes
The fundamental operations in a double-ended queue $D$ are: insertFirst (e) - Insert a new element $e$ at the beginning of $D$. insertLast (e) - Insert a new element $e$ ...
2.1k
views
1 answers
2 votes
​​​​​​You are given a set $V$ of distinct integers. A binary search tree $T$ is created by inserting all elements of $V$ one by one, starting with an empty tr...
430
views
2 answers
2 votes
Consider a binary tree. Among the following traversal combinations, which of them can uniquely construct the tree?Inorder + PreorderPreorder + PostorderOnly InorderInorde...
262
views
1 answers
0 votes
Consider a doubly linked list with the following operations:- Insert First (\texttt{InsertFirst})\\- Insert Last (\texttt{InsertLast})\\- Remove First (\texttt{RemoveFirs...
242
views
1 answers
0 votes
Match the following:$$\begin{array}{|p{0.3\linewidth}|p{0.6\linewidth}|}    \hline    \textbf{Technique} & \textbf{Characteristic} \\    \hline    FIFO & ...
9.3k
views
3 answers
5 votes
A complete binary tree with $n$ non-leaf nodes contains$\log_{2}n$ nodes$n+1$ nodes$2n$ nodes$2n+1$ nodes
467
views
1 answers
4 votes
Suppose you implement a queue using a singly linked list with head and tail pointers so that the front of the queue is at the tail of the list, and the rear of the queue ...
589
views
2 answers
5 votes
Let $B$ be a binary search tree (BST) with eight nodes filled with the following set of eight integer keys $A=\{10,2,5,3,20,15,9,22\}$. The order in which these keys were...
619
views
1 answers
7 votes
Consider a stack whose elements are unsigned integers and support the following operations:PUSH a: Pushes the element 'a' onto the stack.ADD: Adds the two topmost element...
266
views
0 answers
0 votes
Data Structure question: Binary tree question having four options involving no of internal nodes, leaf nodes, height etc.
911
views
3 answers
7 votes
You are given a complete binary tree (each level must be full except the last) on $n$ vertices. Each vertex $v$ is labeled by an integer value $x_v$. Say that a vertex is...
519
views
2 answers
4 votes
Consider the null-terminated linked list of four integers $\textsf{1->2->3->4->NULL},$ and the variable 'list' points to the head of the linked list. Upon running the pro...
463
views
1 answers
3 votes
Let $\mathrm{T}$ be the smallest AVL tree of height $h$. How many nodes does it have, if the smallest AVL tree of height $h-2$ has $m$ nodes and the smallest AVL tree of ...
537
views
1 answers
6 votes
Suppose we constructed the binary search tree shown by starting with an empty tree and inserting one element at a time from an input sequence, without any rotations or ot...
587
views
1 answers
3 votes
Suppose that a binary min-heap stores six elements with priorities $10,20,30,40,50$, and $60$ in its array $\text{A}.$ What is the largest of these items that could be st...
428
views
1 answers
3 votes
The Euclidean algorithm is used to find the greatest common divisor $(\mathrm{gcd})$ of two positive integers $\mathrm{a}$ and $\mathrm{b}$.input(a) input(b) while b>0 be...
421
views
1 answers
2 votes
What are the sequence of popped-out values if the sequence of operations - $\textsf{push(1), push(2), pop, push(1), push(2), pop, pop, pop, push(2), pop}$ are performed o...
499
views
1 answers
2 votes
How many binary trees with $3$ nodes, $\text{A, B},$ and $\text{C}$ when traversed in post-order will give the sequence $\text{A, B, C}?$ (It is NOT a search tree)
502
views
2 answers
4 votes
The in-order traversal of a binary tree is $\textsf{HFIEJGZ},$ and the post-order traversal of the same tree is $\textsf{HIFJZGE}.$ What will be the total number of nodes...
334
views
3 answers
0 votes
In a max heap of n elements, the time complexity to find 10th largest element is:a)Θ(n log n)b)Θ(n)c)Θ(1)d)Θ(log n) I personally think it should be Θ(n), as the 10th...
615
views
0 answers
6 votes
Consider the following binary heap –Suppose the last operation you performed in the binary heap above was inserting the key $x$.What are the possible values of $x?$$20$...
400
views
1 answers
2 votes
Consider the linked list initially having values $1, 2, 2, 8, 6, 2, 2,$ and let the head be the pointer to the first node of the linked list.Which of the following option...
To see more, click for all the questions in this category.