Recent activity in Programming and DS

85 85 votes
7 answers 7 answers
30.6k
30.6k views
Consider a complete binary tree where the left and right subtrees of the root are max-heaps. The lower bound for the number of operations to convert the tree to a heap is...
126 126 votes
9 answers 9 answers
42.8k
42.8k views
Let $T(n)$ be the number of different binary search trees on $n$ distinct elements.Then $T(n) = \sum_{k=1}^{n} T(k-1)T(x)$, where $x$ is $n-k+1$$n-k$$n-k-1$$n-k-2$
76 76 votes
10 answers 10 answers
19.0k
19.0k views
Consider the following two C code segments. $Y$ and $X$ are one and two dimensional arrays of size $n$ and $ n \times n$ respectively, where $2 \leq n \leq 10$. Assume th...
14 14 votes
2 answers 2 answers
11.5k
11.5k views
The results returned by function under value-result and reference parameter passing conventionsDo not differDiffer in the presence of loopsDiffer in all casesMay differ i...
243 243 votes
14 answers 14 answers
62.8k
62.8k views
Let $Q$ denote a queue containing sixteen numbers and $S$ be an empty stack. $Head(Q)$ returns the element at the head of the queue $Q$ without removing it from $Q$. Simi...
0 0 votes
1 1 answer
1.8k
1.8k views
If a record is deleted while another record still contains a pointer to it, that pointer is called a Pinned pointerDangling pointerPointless pointerNone of the above
0 0 votes
1 answers 1 answer
7.8k
7.8k views
138 138 votes
12 answers 12 answers
49.6k
49.6k views
An implementation of a queue $Q$, using two stacks $S1$ and $S2$, is given below: void insert (Q, x) { push (S1, x); } void delete (Q) { if (stack-empty(S2)) then if (sta...
111 111 votes
12 12 answers
44.2k
44.2k views
Consider the queues $Q_{1}$ containing four elements and $Q_{2}$ containing none (shown as the $\textsf{Initial State}$ in the figure). The only operations allowed on the...
59 59 votes
4 answers 4 answers
17.5k
17.5k views
The C language is:A context free languageA context sensitive languageA regular languageParsable fully only by a Turing machine
8 8 votes
2 2 answers
559
559 views
Which of the following statements are true?$\text{S1.}$ Stack operations $\texttt{push}$, $\texttt{pop}$, and $\texttt{isEmpty}$ can be worst-case $O(1)$ for a linked-lis...
34 34 votes
3 3 answers
12.3k
12.3k views
Consider the following C program:#include <stdio.h int gate (int n) { int d, t, newnum, turn; newnum = turn = 0; t=1; while (n>=t) t *= 10; t /=10; while (t>0) { d = n/t;...
106 106 votes
13 answers 13 answers
47.4k
47.4k views
Consider a hash function that distributes keys uniformly. The hash table size is $20$. After hashing of how many keys will the probability that any new key hashed collide...
120 120 votes
14 answers 14 answers
68.2k
68.2k views
The number of possible min-heaps containing each value from $\{1,2,3,4,5,6,7\}$ exactly once is _______
15 15 votes
6 6 answers
8.2k
8.2k views
The height of any rooted tree is defined as the maximum number of edges in the path from the root node to any leaf node.Suppose a Min-Heap $\text{T}$ stores $32$ keys. Th...
78 78 votes
5 answers 5 answers
32.7k
32.7k views
Consider a hash table with $100$ slots. Collisions are resolved using chaining. Assuming simple uniform hashing, what is the probability that the first $3$ slots are unfi...
160 160 votes
16 answers 16 answers
60.5k
60.5k views
A program takes as input a balanced binary search tree with $n$ leaf nodes and computes the value of a function $g(x)$ for each node $x$. If the cost of computing $g(x)$ ...
6 6 votes
3 3 answers
260
260 views
Consider the following statements about Binary Search Trees.$\text{S1}:$ The largest value of a BST is the last value in the list produced by an inorder traversal. $\text...
8 8 votes
4 answers 4 answers
13.6k
13.6k views
A complete binary tree with $n$ non-leaf nodes contains$\log_{2}n$ nodes$n+1$ nodes$2n$ nodes$2n+1$ nodes
9 9 votes
3 3 answers
279
279 views
Consider the problem of finding the middle node in a list $l$ of size $n$, given that $n$ is odd. Count the number of accesses to positions of list $l$ needed to find the...
34 34 votes
6 6 answers
19.2k
19.2k views
Consider the $\text{C}$ function $\text{foo}$ and the binary tree shown.typedef struct node { int val; struct node *left, *right; } node; int foo(node *p) { int retval; i...
154 154 votes
10 answers 10 answers
39.2k
39.2k views
A weight-balanced tree is a binary tree in which for each node, the number of nodes in the left sub tree is at least half and at most twice the number of nodes in the rig...
117 117 votes
10 answers 10 answers
42.1k
42.1k views
Which one of the choices given below would be printed when the following program is executed?#include <stdio.h void swap (int *x, int *y) { static int *temp; temp = x; x ...
9 9 votes
6 6 answers
2.1k
2.1k views
Consider the following code snippet in C language that computes the number of nodes in a non-empty singly linked list pointed to by the pointer variable head.struct node{...
162 162 votes
11 answers 11 answers
45.1k
45.1k views
Consider the following C program.#include<stdio.h #include<string.h void printlength(char *s, char *t) { unsigned int c=0; int len = ((strlen(s) - strlen(t)) c) ? strlen...
259 259 votes
22 answers 22 answers
79.0k
79.0k views
The number of ways in which the numbers $1, 2, 3, 4, 5, 6, 7$ can be inserted in an empty binary search tree, such that the resulting tree has height $6$, is _________.No...
1 1 vote
0 0 answers
63
63 views
38 38 votes
8 8 answers
14.0k
14.0k views
Let $\mathrm{LIST}$ be a datatype for an implementation of linked list defined as follows:typedef struct list { int data; struct list *next; } LIST;Suppose a program has ...
110 110 votes
12 answers 12 answers
44.6k
44.6k views
Consider the following C program:#include <stdio.h int r() { static int num=7; return num ; } int main() { for (r();r();r()) printf(“%d”,r()); return 0; }Which one of the...
86 86 votes
5 answers 5 answers
20.7k
20.7k views
Consider the following "C" program.void f(int, short); void main() { int i = 100; short s = 12; short *p = &s; ____________; // call to f() } Which one of the following e...
To see more, click for all the questions in this category.