Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Webpage
Programming in C.
Recursion.
Filter
Recent
Hot!
Most votes
Most answers
Most views
Previous GATE
Featured
Most answered questions in Programming and DS
90
votes
11
answers
21
GATE CSE 2014 Set 1 | Question: 12
Consider a rooted n node binary tree represented using pointers. The best upper bound on the time required to determine the number of subtrees having exactly $4$ nodes is $O(n^a\log^bn)$. Then the value of $a+10b$ is __________.
Consider a rooted n node binary tree represented using pointers. The best upper bound on the time required to determine the number of subtrees having exactly $4$ nodes is...
go_editor
24.6k
views
go_editor
asked
Sep 26, 2014
DS
gatecse-2014-set1
data-structures
binary-tree
numerical-answers
normal
+
–
29
votes
11
answers
22
GATE CSE 1998 | Question: 2.11
A complete $n$-ary tree is one in which every node has $0$ or $n$ sons. If $x$ is the number of internal nodes of a complete $n$-ary tree, the number of leaves in it is given by $x(n-1) +1$ $xn-1$ $xn +1$ $x(n+1)$
A complete $n$-ary tree is one in which every node has $0$ or $n$ sons. If $x$ is the number of internal nodes of a complete $n$-ary tree, the number of leaves in it is g...
Kathleen
14.7k
views
Kathleen
asked
Sep 25, 2014
DS
gate1998
data-structures
tree
normal
+
–
103
votes
11
answers
23
GATE CSE 2004 | Question: 85
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)$ ... time complexity of the program is? $\Theta (n)$ $\Theta (n \log n)$ $\Theta(n^2)$ $\Theta (n^2\log n)$
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)$ ...
Kathleen
33.0k
views
Kathleen
asked
Sep 18, 2014
DS
gatecse-2004
binary-search-tree
normal
data-structures
+
–
33
votes
10
answers
24
GATE CSE 2017 Set 1 | Question: 6
Let $T$ be a binary search tree with $15$ nodes. The minimum and maximum possible heights of $T$ are: Note: The height of a tree with a single node is $0$. $4$ and $15$ respectively. $3$ and $14$ respectively. $4$ and $14$ respectively. $3$ and $15$ respectively.
Let $T$ be a binary search tree with $15$ nodes. The minimum and maximum possible heights of $T$ are:Note: The height of a tree with a single node is $0$.$4$ and $15$ res...
Arjun
16.7k
views
Arjun
asked
Feb 14, 2017
DS
gatecse-2017-set1
data-structures
binary-search-tree
easy
+
–
73
votes
10
answers
25
GATE CSE 2010 | Question: 53
A hash table of length $10$ uses open addressing with hash function $h(k) = k \: \mod \: 10$, and linear probing. After inserting $6$ ... of the key values using the same hash function and linear probing will result in the hash table shown above? $10$ $20$ $30$ $40$
A hash table of length $10$ uses open addressing with hash function $h(k) = k \: \mod \: 10$, and linear probing. After inserting $6$ values into an empty hash table, the...
go_editor
27.3k
views
go_editor
asked
Apr 21, 2016
DS
data-structures
hashing
normal
gatecse-2010
+
–
58
votes
10
answers
26
GATE CSE 2014 Set 3 | Question: 42
Consider the C function given below. Assume that the array $listA$ contains $n (>0)$ elements, sorted in ascending order. int ProcessArray(int *listA, int x, int n) { int i, j, k; i = 0; j = n-1; do { k = (i+j)/2; if ... implementation of binary search. It will always find the maximum element in $listA$. It will return −$1$ even when $x$ is present in $listA$.
Consider the C function given below. Assume that the array $listA$ contains $n (>0)$ elements, sorted in ascending order.int ProcessArray(int *listA, int x, int n) { in...
go_editor
13.5k
views
go_editor
asked
Sep 28, 2014
DS
gatecse-2014-set3
data-structures
array
easy
+
–
79
votes
10
answers
27
GATE CSE 2003 | Question: 23
In a min-heap with $n$ elements with the smallest element at the root, the $7^{th}$ smallest element can be found in time $\Theta (n \log n)$ $\Theta (n)$ $\Theta(\log n)$ $\Theta(1)$
In a min-heap with $n$ elements with the smallest element at the root, the $7^{th}$ smallest element can be found in time$\Theta (n \log n)$$\Theta (n)$$\Theta(\log n)$$\...
Disha
32.0k
views
Disha
asked
Sep 19, 2014
DS
gatecse-2003
data-structures
binary-heap
+
–
36
votes
9
answers
28
GATE CSE 2020 | Question: 16
What is the worst case time complexity of inserting $n$ elements into an empty linked list, if the linked list needs to be maintained in sorted order? $\Theta(n)$ $\Theta(n \log n)$ $\Theta ( n)^{2}$ $\Theta(1)$
What is the worst case time complexity of inserting $n$ elements into an empty linked list, if the linked list needs to be maintained in sorted order?$\Theta(n)$$\Theta(n...
Arjun
26.5k
views
Arjun
asked
Feb 12, 2020
DS
gatecse-2020
linked-list
1-mark
+
–
59
votes
9
answers
29
GATE CSE 2019 | Question: 27
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 following values will be displayed on execution of the programs? $41$ $52$ $63$ $630$
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...
Arjun
27.4k
views
Arjun
asked
Feb 7, 2019
Programming in C
gatecse-2019
programming-in-c
programming
2-marks
+
–
71
votes
9
answers
30
GATE CSE 2019 | Question: 46
Let $T$ be a full binary tree with $8$ leaves. (A full binary tree has every level full.) Suppose two leaves $a$ and $b$ of $T$ are chosen uniformly and independently at random. The expected value of the distance between $a$ and $b$ in $T$ (ie., the number of edges in the unique path between $a$ and $b$) is (rounded off to $2$ decimal places) _________.
Let $T$ be a full binary tree with $8$ leaves. (A full binary tree has every level full.) Suppose two leaves $a$ and $b$ of $T$ are chosen uniformly and independently at ...
Arjun
30.7k
views
Arjun
asked
Feb 7, 2019
DS
gatecse-2019
numerical-answers
data-structures
binary-tree
2-marks
+
–
7
votes
9
answers
31
AVL tree
The number of different orders are possible for elements 1, 2, 3, 4, 5, 6, 7 to be inserted in to empty AVL tree such that no rotation will be done and element ‘4’ is root are ________.
The number of different orders are possible for elements 1, 2, 3, 4, 5, 6, 7 to be inserted in to empty AVL tree such that no rotation will be done and element ‘4’ is...
syncronizing
9.0k
views
syncronizing
asked
Sep 15, 2018
DS
data-structures
avl-tree
numerical-answers
+
–
42
votes
9
answers
32
GATE CSE 2018 | Question: 2
Consider the following C program: #include<stdio.h> struct Ournode{ char x, y, z; }; int main() { struct Ournode p={'1', '0', 'a'+2}; struct Ournode *q=&p; printf("%c, %c", *((char*)q+1), *((char*)q+2)); return 0; } The output of this program is: 0, c 0, a+2 '0', 'a+2' '0', 'c'
Consider the following C program:#include<stdio.h struct Ournode{ char x, y, z; }; int main() { struct Ournode p={'1', '0', 'a'+2}; struct Ournode *q=&p; printf("%c, %c",...
gatecse
20.4k
views
gatecse
asked
Feb 14, 2018
Programming in C
gatecse-2018
programming-in-c
programming
structure
normal
1-mark
+
–
102
votes
9
answers
33
GATE CSE 2017 Set 1 | Question: 53
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(s) : strlen(t); printf("%d\n", len); } ... in $string.h$ as returning a value of type $size\_t$, which is an unsigned int. The output of the program is __________ .
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...
srestha
25.0k
views
srestha
asked
Feb 14, 2017
Programming in C
gatecse-2017-set1
programming
programming-in-c
normal
numerical-answers
+
–
7
votes
9
answers
34
ISRO2014-3
What is the output of the following C program? #include<stdio.h> #define SQR(x) (x*x) int main() { int a; int b=4; a=SQR(b+2); printf("%d\n",a); return 0; } 14 36 18 20
What is the output of the following C program? #include<stdio.h #define SQR(x) (x*x) int main() { int a; int b=4; a=SQR(b+2); printf("%d\n",a); return 0; }14361820
pooja14
8.1k
views
pooja14
asked
Jun 22, 2016
Programming in C
programming-in-c
macros
isro2014
+
–
65
votes
9
answers
35
GATE CSE 2016 Set 1 | Question: 38
Consider the weighted undirected graph with $4$ vertices, where the weight of edge $\{i,j\}$ is given by the entry $W_{ij}$ in the matrix $W$ ... integer value of $x$, for which at least one shortest path between some pair of vertices will contain the edge with weight $x$ is ___________.
Consider the weighted undirected graph with $4$ vertices, where the weight of edge $\{i,j\}$ is given by the entry $W_{ij}$ in the matrix $W$. W=$\begin{bmatrix} 0&2 &8 &...
Sandeep Singh
24.0k
views
Sandeep Singh
asked
Feb 12, 2016
DS
gatecse-2016-set1
data-structures
graph-theory
normal
numerical-answers
+
–
9
votes
9
answers
36
ISRO2014-73
How many different trees are there with four nodes $\text{A, B, C}$ and $\text{D}?$ $30$ $60$ $90$ $120$
How many different trees are there with four nodes $\text{A, B, C}$ and $\text{D}?$$30$$60$$90$$120$
ajit
14.7k
views
ajit
asked
Sep 23, 2015
DS
isro2014
data-structures
tree
combinatory
+
–
44
votes
9
answers
37
GATE CSE 1998 | Question: 19b
Compute the post fix equivalent of the following expression $3^*\log(x+1)-\frac{a}{2}$
Compute the post fix equivalent of the following expression $3^*\log(x+1)-\frac{a}{2}$
Arjun
15.8k
views
Arjun
asked
Aug 29, 2015
DS
gate1998
stack
infix-prefix
descriptive
+
–
72
votes
9
answers
38
GATE CSE 2015 Set 2 | Question: 31
A Young tableau is a $2D$ array of integers increasing from left to right and from top to bottom. Any unfilled entries are marked with $\infty$, and hence there cannot be any entry to the right of, or below a $\infty$. The following Young tableau ... The minimum number of entries (other than $1$) to be shifted, to remove $1$ from the given Young tableau is _____.
A Young tableau is a $2D$ array of integers increasing from left to right and from top to bottom. Any unfilled entries are marked with $\infty$, and hence there cannot be...
go_editor
13.2k
views
go_editor
asked
Feb 12, 2015
DS
gatecse-2015-set2
databases
array
normal
numerical-answers
+
–
65
votes
9
answers
39
GATE IT 2004 | Question: 13
Let $P$ be a singly linked list. Let $Q$ be the pointer to an intermediate node $x$ in the list. What is the worst-case time complexity of the best-known algorithm to delete the node $x$ from the list ? $O(n)$ $O(\log^2 n)$ $O(\log n)$ $O(1)$
Let $P$ be a singly linked list. Let $Q$ be the pointer to an intermediate node $x$ in the list. What is the worst-case time complexity of the best-known algorithm to del...
Ishrat Jahan
24.9k
views
Ishrat Jahan
asked
Nov 1, 2014
DS
gateit-2004
data-structures
linked-list
normal
ambiguous
+
–
48
votes
9
answers
40
GATE CSE 2011 | Question: 29
We are given a set of $n$ distinct elements and an unlabeled binary tree with $n$ nodes. In how many ways can we populate the tree with the given set so that it becomes a binary search tree? $0$ $1$ $n!$ $\frac{1} {n+1} .^{2n}C_n$
We are given a set of $n$ distinct elements and an unlabeled binary tree with $n$ nodes. In how many ways can we populate the tree with the given set so that it becomes a...
go_editor
31.8k
views
go_editor
asked
Sep 29, 2014
DS
gatecse-2011
binary-tree
normal
+
–
Page:
« prev
1
2
3
4
5
6
7
...
310
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register