The Gateway to Computer Science Excellence
For all GATE CSE Questions
Toggle navigation
Facebook Login
or
Email or Username
Password
Remember
Login
Register

I forgot my password
Activity
Questions
Unanswered
Tags
Subjects
Users
Ask
Prev
Blogs
New Blog
Exams
First time here? Checkout the
FAQ
!
x
×
Close
Use the google search bar on side panel. It searches through all previous GATE/other questions. For hardcopy of previous year questions please see
here
Recent questions tagged gb2019gtdsa
+2
votes
0
answers
1
GATEBOOK2019 Grand Test DS&A1
What would be the worst case time complexity to build binary search tree with given $n$ arbitrary elements? $\Theta(n \log n)$ $\Theta(n)$ $\Theta(n^{2})$ $\Theta( \log n)$
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

221
views
gb2019gtdsa
+2
votes
1
answer
2
GATEBOOK2019 Grand Test DS&A2
An array of size $N$ contains $0's$ followed by $1's$. What is the worst case time complexity of best algorithm to find whether there are more number of $0's$ or more number of $1's$? $\Theta(n \log n)$ $\Theta(\log n)$ $\Theta(n)$ $\Theta(1)$
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

116
views
gb2019gtdsa
0
votes
2
answers
3
GATEBOOK2019 Grand Test DS&A3
Consider the following exponential search algorithm(ES). The array of $n$ elements to be searched is divided in to $ \log n$ parts. The $i^{th}$ part is from index $2^{i1}$ to $2^{i}$. To search an element all the parts are searched one by one from ... complexity of above searching algorithm? $\Theta(n \log n )$ $\Theta( \log n)^{2}$ $\Theta(\log n)$ $\Theta(n)$
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

141
views
gb2019gtdsa
0
votes
1
answer
4
GATEBOOK2019 Grand Test DS&A4
Which of the following cannot be the intermediate sequence if we apply quick sort on $9,8,7,6,5,4,3,2,1$ ? Assume the pivot is always the first element $1,8,7,6,5,4,3,2,9$ $1,2,3,6,5,4,7,8,9$ $1,2,7,6,5,4,3,8,9$ $1,2,3,5,4,6,7,8,9$
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

121
views
gb2019gtdsa
0
votes
1
answer
5
GATEBOOK2019 Grand Test DS&A5
Suppose we are sorting an array of eight integers using quick sort, and we have just finished the first partitioning with the array looking like this: $2 \quad 5 \quad 1 \quad 7 \quad 9 \quad 12 \quad 11 \quad 10$. Which of the following statement is correct? The pivot ... can not be $9$. The pivot is not $7$, but it could be $9$. Neither $7$ nor $9$ is the pivot.
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

61
views
gb2019gtdsa
0
votes
1
answer
6
GATEBOOK2019 Grand Test DS&A6
What are minimum and maximum number of nodes in a heap tree of height $h$? $2^{h}$ to $2^{h+1}$ $2^{h1} +1$ to $2^{h}$ $2^{h}$ to $2^{h+1} 1$ $2^{h1}$ to $2^{h+1}$
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

64
views
gb2019gtdsa
0
votes
2
answers
7
GATEBOOK2019 Grand Test DS&A7
int f(int n) { if (n == 0) return 1; return f(n1)  n + f(n1) + 2; } what is the output if $f(5)$ is called? $37$ $11$ $20$ $33$
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

58
views
gb2019gtdsa
+1
vote
1
answer
8
GATEBOOK2019 Grand Test DS&A8
The time required to check whether given tree is binary search tree or not in the worst case is $\Theta(n)$ $\Theta(n\log n)$ $\Theta(\log n)$ $\Theta(n^2)$
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

92
views
gb2019gtdsa
binarysearchtree
0
votes
0
answers
9
GATEBOOK2019 Grand Test DS&A9
Given an array of integers what is the worst case time complexity that would find pair of integers which are same? $\Theta(n \log n)$ $\Theta(n)$ $\Theta(n^2)$ $\Theta(n \log \log n)$
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

142
views
gb2019gtdsa
0
votes
1
answer
10
GATEBOOK2019 Grand Test DS&A10
void main(){ char p[] = "GATEBOOK"; p=p+1; printf("%s",p); } What is the output of the above program? It generates runtime error It generates compile time error GATEBOOK ATEBOOK
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

124
views
gb2019gtdsa
+1
vote
1
answer
11
GATEBOOK2019 Grand Test DS&A11
The no of different balanced parenthesizes possible with $n$ pairs of parenthesis? $\dfrac{^{2n}C_{n}}{n+1}$ $\dfrac{^{2(n1)}C_{n1}}{n}$ $(2n)!$ $n!$
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

70
views
gb2019gtdsa
0
votes
0
answers
12
GATEBOOK2019 Grand Test DS&A12
#include <stdio.h> typedef struct node { char data; struct node* next; } Node; Node* mystery(Node* root) { Node* new_root = 0; while (root) { Node* next = root>next; root>next = new_root; ... singly linked list? List will remain same Every two consecutive nodes from left to right are swapped Reverses the linked list None of the above
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

92
views
gb2019gtdsa
0
votes
1
answer
13
GATEBOOK2019 Grand Test DS&A13
Given a binary tree what is the time complexity of finding the height of the tree where $ \text{n = no of nodes}$ and $\text{h= height of the tree}?$ $\Theta(n)$ $\Theta(h)$ $\Theta(nh)$ $\Theta( \log n)$
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

86
views
gb2019gtdsa
0
votes
3
answers
14
GATEBOOK2019 Grand Test DS&A14
Suppose that an application has a huge number of $\text{INSERT}$ operations, but only a few $\text{DELETE_MAX}$ operations. Which of the following priorityqueue implementations will be most effective? $\text{Max heap}$ $\text{Unordered array}$ $\text{Ordered array}$ $\text{Binary search tree}$
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

91
views
gb2019gtdsa
priorityqueue
0
votes
2
answers
15
GATEBOOK2019 Grand Test DS&A15
Suppose that a certain BST has keys that are integers between $1$ and $10$, and we search for $5$. Which of the sequence below cannot be the sequence of keys examined? $10, 9, 8, 7, 6, 5$ $1, 10, 2, 9, 3, 8, 4, 7, 6, 5$ $2, 7, 3, 8, 4, 5$ $1, 2, 10, 4, 8, 5$
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

54
views
gb2019gtdsa
0
votes
1
answer
16
GATEBOOK2019 Grand Test DS&A16
The number of binary search trees with $2n+1$ keys where median is the root? $\left (\dfrac{^{2n}C_n}{n+1}\right)^{2}$ $(n!)^{2}$ $(2n+1)!$ Depends on the values of the keys
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

86
views
gb2019gtdsa
0
votes
0
answers
17
GATEBOOK2019 Grand Test DS&A17
$T(0)=0$ and $T(1)=1$ and each of the following recurrences for $n \geq 2$ defines a function $T$ on nonnegative integers. Which of the following CANNOT be bounded (above) by a polynomial function? $T(n) = 3T(\frac{n}{2})+n^2$ $T(n) = 4T(\frac{n}{2})+ n$ $T(n) = 2T(n2) + 1$ $T(n) = T(n1)+ n^2$
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

85
views
gb2019gtdsa
0
votes
0
answers
18
GATEBOOK2019 Grand Test DS&A18
int f () { int k, result; result = 0; for ( k = 0; k < 5; k++ ) { if ( ( k % 3 ) == 1 ) result = result + k; else result = result + 1; } return result; } The value returned for the call to $f ()$ ? $5$ $6$ $7$ $8$
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

45
views
gb2019gtdsa
0
votes
1
answer
19
GATEBOOK2019 Grand Test DS&A19
Consider the following pseudocode program. int i; main () { i = 3; S (); R (); } void S () { print i; // prints the value of i on the current line of output print " " // prints a blank space on the current line of output } void R () { int i; i = 2; S (); } ... $3 \quad 2 : 3 \quad 2$ $3 \quad 3 : 2 \quad 2$ $3 \quad 3 : 2 \quad 3$ $3 \quad 3 : 3 \quad 2$
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

51
views
gb2019gtdsa
0
votes
1
answer
20
GATEBOOK2019 Grand Test DS&A20
void P1 (int x, int y, int z) { if ((x != 0) && ((y / x) == z)) z = z + 1; printf("x = %d" " y = %d" " z = %d",x,y,z ); } public void P2 (int x, int y, int z) { if (((y / x) == z) && ... and $P2(x, y, z)$ behave differently For all $x$ and $z$, there exists $y$ such that $P1(x, y, z)$ and $P2(x, y, z)$ behave differently
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

108
views
gb2019gtdsa
0
votes
1
answer
21
GATEBOOK2019 Grand Test DS&A21
Which of the following is the time complexity of topological sort of a graph $G(V,E)$ $\Theta(V+E)$ $\Theta(V)$ $\Theta(V+E)\log V$ $\Theta(VE)$
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

58
views
gb2019gtdsa
0
votes
2
answers
22
GATEBOOK2019 Grand Test DS&A23
Which of the following problem cannot be computed by DFS? Finding connected components in directed graph Finding shortest path in unweighted graph Finding directed cycle in directed graph Finding a path from a source vertex to all other reachable vertices in directed graph
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

84
views
gb2019gtdsa
0
votes
1
answer
23
GATEBOOK2019 Grand Test DS&A24
A dynamically growing array is implemented using fixed size array by the following method. Initially a $k$ element array is created using $malloc$ and then once it is full a $2*k$ size array is created using $malloc$ and values in previously allocated array are copied in ... from previous array to new array is $\Theta(n)$ $\Theta(2^n)$ $\Theta(n!)$ $\Theta(n^2)$
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

79
views
gb2019gtdsa
numericalanswers
0
votes
0
answers
24
GATEBOOK2019 Grand Test DS&A25
int foo(int a, int b) { if (a%b == 0) return b; else return foo(b, a%b); } What is the output given by $foo(17, 3)$? $3$ $17$ $51$ $1$
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

55
views
gb2019gtdsa
recursion
0
votes
0
answers
25
GATEBOOK2019 Grand Test DS&A26
Closest pair of an array of integers is two values whose difference is no greater than the difference of any other pair in the array. The best algorithm to compute closest pair in the worst case is $\Theta(n)$ $\Theta(n^2)$ $\Theta(n\log n)$ $\Theta(n^3)$
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

65
views
gb2019gtdsa
0
votes
1
answer
26
GATEBOOK2019 Grand Test DS&A27
The maximum height an AVL tree can have with $77$ nodes $8$ $9$ $6$ $7$
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

97
views
gb2019gtdsa
+2
votes
1
answer
27
GATEBOOK2019 Grand Test DS&A28
A hash function $h$ maps $16bit$ inputs to $8bit$ hash values. What is the largest $k$ such that in any set of $1,000$ inputs, there are at least $k$ inputs that $h$ maps to the same hash value? $3$ $4$ $10$ $64$
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

180
views
gb2019gtdsa
0
votes
0
answers
28
GATEBOOK2019 Grand Test DS&A29
A thief faces $0/1$ KNAPSACK problem. There are $7$ items to be packed into the knapsack, each with value $V_{i}$ and weight $W_{i}$ ... $\begin{array} { c  c  }\hline 30 & \text{Not Optimal} \\ \hline\end{array}$
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

64
views
gb2019gtdsa
0
votes
1
answer
29
GATEBOOK2019 Grand Test DS&A30
Consider messages made up entirely of vowels $(A, E, I, O, U)$ ... $100$ vowels is ___ $225$ $300$ $250$ $232$
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

71
views
gb2019gtdsa
To see more, click for the
full list of questions
or
popular tags
.
Quick search syntax
tags
tag:apple
author
user:martin
title
title:apple
content
content:apple
exclude
tag:apple
force match
+apple
views
views:100
score
score:10
answers
answers:2
is accepted
isaccepted:true
is closed
isclosed:true
Recent Posts
The day that made me an IIScian :)
Unanswered Previous year GATE/TIFR questions
From being a Failure to getting into IISc  (Rank 888, Score 692)
My interview experience at IITs/IISc
IIT Delhi CSE Mtech interview 14 may
Follow @csegate
Recent questions tagged gb2019gtdsa
Recent Blog Comments
@Debargh, Yes. 👍
Thanks. Regarding the probability question, was...
Thanks
What were the Eigen values of A apart from 0? I...
49,540
questions
54,099
answers
187,269
comments
71,006
users