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
Highest voted questions in Programming and DS
Recent
Hot!
Most votes
Most answers
Most views
Featured
Previous GATE
Webpage
Programming in C.
Recursion.
Recent
Hot!
Most votes
Most answers
Most views
Featured
Previous GATE
+100
votes
8
answers
1
GATE2007IT29
When searching for the key value $60$ in a binary search tree, nodes containing the key values $10, 20, 40, 50, 70, 80, 90$ are traversed, not necessarily in the order given. How many different orders are possible in which these key values can occur on the search path from the root to the node containing the value $60$? $35$ $64$ $128$ $5040$
asked
Oct 30, 2014
in
DS
by
Ishrat Jahan
Boss
(
16.3k
points)

13k
views
gate2007it
datastructures
binarysearchtree
normal
+93
votes
14
answers
2
GATE2016240
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 _________. Note: The height of a tree with a single node is $0$.
asked
Feb 12, 2016
in
DS
by
Akash Kanase
Boss
(
41.9k
points)

13.8k
views
gate20162
datastructures
binarysearchtree
normal
numericalanswers
+76
votes
2
answers
3
GATE2014211
Suppose $n$ and $p$ are unsigned int variables in a C program. We wish to set p to $^nC_3$. If $n$ is large, which one of the following statements is most likely to set p correctly? $p = n * (n1) * (n2) / 6;$ $p = n * (n1) / 2 * (n2) / 3;$ $p = n * (n1) / 3 * (n2) / 2;$ $p = n * (n1) * (n2) / 6.0;$
asked
Sep 28, 2014
in
Programming
by
jothee
Veteran
(
106k
points)

5.1k
views
gate20142
programming
programminginc
normal
+74
votes
9
answers
4
GATE2016141
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$. Similarly $Top(S)$ returns the element at the top of $S$ without removing it from $S$. ... else x:= Pop(S); Enqueue (Q, x); end end The maximum possible number of iterations of the while loop in the algorithm is _______.
asked
Feb 12, 2016
in
DS
by
Sandeep Singh
Loyal
(
7.2k
points)

10.2k
views
gate20161
datastructures
queues
difficult
numericalanswers
+71
votes
5
answers
5
GATE2015135
What is the output of the following C code? Assume that the address of $x$ is $2000$ (in decimal) and an integer requires four bytes of memory. int main () { unsigned int x [4] [3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}}; printf ("%u, %u, %u", x + 3, *(x + 3), *(x + 2) + 3); } $2036, 2036, 2036$ $2012, 4, 2204$ $2036, 10, 10$ $2012, 4, 6$
asked
Feb 13, 2015
in
Programming
by
makhdoom ghaya
Boss
(
30.9k
points)

8.5k
views
gate20151
programming
programminginc
normal
+65
votes
6
answers
6
GATE2014339
Suppose we have a balanced binary search tree $T$ holding $n$ numbers. We are given two numbers $L$ and $H$ and wish to sum up all the numbers in $T$ that lie between $L$ and $H$. Suppose there are $m$ such numbers in $T$. If the tightest upper bound on the time to compute the sum is $O(n^a\log^bn+m^c\log^dn)$, the value of $a+10b+100c+1000d$ is ______.
asked
Sep 28, 2014
in
DS
by
jothee
Veteran
(
106k
points)

10.8k
views
gate20143
datastructures
binarysearchtree
numericalanswers
normal
+64
votes
5
answers
7
GATE200846
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$ as its postorder traversal. What is the time complexity of the most efficient algorithm for doing this? $\Theta(\log n)$ $\Theta(n)$ $\Theta(n\log n)$ None of the above, as the tree cannot be uniquely determined
asked
Sep 12, 2014
in
DS
by
Kathleen
Veteran
(
52.2k
points)

11.9k
views
gate2008
datastructures
binarysearchtree
normal
+62
votes
7
answers
8
GATE2017153
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); } void main() ... is defined in $string.h$ as returning a value of type $size\_t$, which is an unsigned int. The output of the program is __________ .
asked
Feb 14, 2017
in
Programming
by
srestha
Veteran
(
119k
points)

8.9k
views
gate20171
programming
programminginc
normal
numericalanswers
+57
votes
3
answers
9
GATE20022.12
A weightbalanced 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 right sub tree. The maximum possible height (number of nodes on the path from the root to the furthest leaf) of such ... by which of the following? $\log_2 n$ $\log_{\frac{4}{3}} n$ $\log_3 n$ $\log_{\frac{3}{2}} n$
asked
Sep 16, 2014
in
DS
by
Kathleen
Veteran
(
52.2k
points)

7.2k
views
gate2002
datastructures
binarytree
normal
+55
votes
9
answers
10
GATE2014112
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 __________.
asked
Sep 26, 2014
in
DS
by
jothee
Veteran
(
106k
points)

6.8k
views
gate20141
datastructures
binarytree
numericalanswers
normal
+54
votes
7
answers
11
GATE200485
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)$ is: $\Large \min \left ( \substack{\text{number of leafnodes}\\\text{in leftsubtree of $ ... worstcase time complexity of the program is? $\Theta (n)$ $\Theta (n \log n)$ $\Theta(n^2)$ $\Theta (n^2\log n)$
asked
Sep 19, 2014
in
DS
by
Kathleen
Veteran
(
52.2k
points)

9.3k
views
gate2004
binarysearchtree
normal
datastructures
+53
votes
8
answers
12
GATE2017108
Consider the C code fragment given below. typedef struct node { int data; node* next; } node; void join(node* m, node* n) { node* p = n; while(p>next != NULL) { p = p>next; } p>next = m; } Assuming that m and n point to valid NULL ... or append list m to the end of list n. cause a null pointer dereference for all inputs. append list n to the end of list m for all inputs.
asked
Feb 14, 2017
in
DS
by
khushtak
Loyal
(
7.1k
points)

8.9k
views
gate20171
datastructures
linkedlists
normal
+53
votes
7
answers
13
GATE2006IT49
Which one of the choices given below would be printed when the following program is executed ? #include <stdio.h> struct test { int i; char *c; }st[] = {5, "become", 4, "better", 6, "jungle", 8, "ancestor", 7, "brother"}; ... $\text{etter, u, 6, ungle}$ $\text{cetter, k, 6, jungle}$ $\text{etter, u, 8, ncestor}$
asked
Nov 1, 2014
in
Programming
by
Ishrat Jahan
Boss
(
16.3k
points)

7k
views
gate2006it
programming
programminginc
normal
+50
votes
6
answers
14
GATE2017136
Consider the C functions foo and bar given below: int foo(int val) { int x=0; while(val > 0) { x = x + foo(val); } return val; } int bar(int val) { int x = 0; while(val > 0) { x= x + bar( ... will result in: Return of $6$ and $6$ respectively. Infinite loop and abnormal termination respectively. Abnormal termination and infinite loop respectively. Both terminating abnormally.
asked
Feb 14, 2017
in
Programming
by
Arjun
Veteran
(
432k
points)

8.8k
views
gate20171
programminginc
programming
normal
+50
votes
5
answers
15
GATE2016234
A complete binary minheap is made by including each integer in $[1, 1023]$ exactly once. The depth of a node in the heap is the length of the path from the root of the heap to that node. Thus, the root is at depth $0$. The maximum depth at which integer $9$ can appear is _________.
asked
Feb 12, 2016
in
DS
by
Akash Kanase
Boss
(
41.9k
points)

7.1k
views
gate20162
datastructures
heap
normal
numericalanswers
+50
votes
6
answers
16
GATE2016215
$N$ items are stored in a sorted doubly linked list. For a delete operation, a pointer is provided to the record to be deleted. For a decreasekey operation, a pointer is provided to the record on which the operation is to be performed. An algorithm performs the following operations on the list in ... put together? $O(\log^{2} N)$ $O(N)$ $O(N^{2})$ $\Theta\left(N^{2}\log N\right)$
asked
Feb 12, 2016
in
DS
by
Akash Kanase
Boss
(
41.9k
points)

11k
views
gate20162
datastructures
linkedlists
timecomplexity
normal
+50
votes
6
answers
17
GATE200649
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 (stackempty(S2)) then if (stackempty(S1)) then { print( Q is empty ); return; } else while (!(stackempty(S1))){ x=pop(S1); push(S2 ... $2m\leq y\leq 2n $ $ 2m\leq x<2n $ and $2m\leq y\leq n+m $ $ 2m\leq x<2n $ and $2m\leq y\leq 2n $
asked
Sep 26, 2014
in
DS
by
Rucha Shelke
Active
(
3.3k
points)

7.1k
views
gate2006
datastructures
queues
stack
normal
+48
votes
5
answers
18
GATE2006IT50
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 = y; y = temp; } void printab () { static int i, a = 3, b = 6; i = 0; while (i <= 4) { if ((i++)%2 == 1) continue; ... $a = 12, b = 9$ $a = 3, b = 6$ $a = 3, b = 6$ $a = 6, b = 3$ $a = 15, b = 12$
asked
Nov 1, 2014
in
Programming
by
Ishrat Jahan
Boss
(
16.3k
points)

6.1k
views
gate2006it
programming
programminginc
normal
+47
votes
9
answers
19
GATE201053
A hash table of length $10$ uses open addressing with hash function $h(k) = k \: mod \: 10$, and linear probing. After inserting $6$ ... sequences of the key values using the same hash function and linear probing will result in the hash table shown above? $10$ $20$ $30$ $40$
asked
Apr 21, 2016
in
DS
by
jothee
Veteran
(
106k
points)

7k
views
datastructures
hashing
normal
gate2010
+46
votes
8
answers
20
GATE2015231
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 consists of ... $1$) to be shifted, to remove $1$ from the given Young tableau is _____.
asked
Feb 12, 2015
in
DS
by
jothee
Veteran
(
106k
points)

3.9k
views
gate20152
databases
arrays
normal
numericalanswers
+46
votes
4
answers
21
GATE20036
Let $T(n)$ be the number of different binary search trees on $n$ distinct elements. Then $T(n) = \sum_{k=1}^{n} T(k1)T(x)$, where $x$ is $nk+1$ $nk$ $nk1$ $nk2$
asked
Sep 16, 2014
in
DS
by
Kathleen
Veteran
(
52.2k
points)

5.3k
views
gate2003
normal
binarysearchtree
+46
votes
5
answers
22
GATE201344
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 > 0) { Dequeue(Q) m = m – 1 } } What is the worst case time complexity of a sequence of $n$ queue operations on an initially empty queue? $Θ(n)$ $Θ(n + k)$ $Θ(nk)$ $Θ(n^2)$
asked
Aug 7, 2014
in
DS
by
gatecse
Boss
(
17.5k
points)

8.9k
views
gate2013
datastructures
algorithms
normal
queues
+45
votes
9
answers
23
GATE200364
Let S be a stack of size $n \geq1$. Starting with the empty stack, suppose we push the first n natural numbers in sequence, and then perform $n$ pop operations. Assume that Push and Pop operations take $X$ seconds each, and $Y$ seconds elapse between the end of one such stack operation ... from S. The average stacklife of an element of this stack is $n(X+Y)$ $3Y+2X$ $n(X+Y)X$ $Y+2X$
asked
Sep 17, 2014
in
DS
by
Kathleen
Veteran
(
52.2k
points)

7.2k
views
gate2003
datastructures
stack
normal
+44
votes
1
answer
24
GATE2015348
Consider the following C program: #include<stdio.h> int main() { int i, j, k = 0; j=2 * 3 / 4 + 2.0 / 5 + 8 / 5; k=j; for (i=0; i<5; i++) { switch(i+k) { case 1: case 2: printf("\n%d", i+k); case 3: printf("\n%d", i+k); default: printf("\n%d", i+k); } } return 0; } The number of times printf statement is executed is _______.
asked
Feb 16, 2015
in
Programming
by
jothee
Veteran
(
106k
points)

6.1k
views
gate20153
programming
programminginc
normal
numericalanswers
+44
votes
2
answers
25
GATE2005IT13
A function $f$ defined on stacks of integers satisfies the following properties. $f(∅) = 0$ and $f (push (S, i)) = max (f(S), 0) + i$ for all stacks $S$ and integers $i$. If a stack $S$ contains the integers $2, 3, 2, 1, 2$ in order from bottom to top, what is $f(S)$? $6$ $4$ $3$ $2$
asked
Nov 3, 2014
in
DS
by
Ishrat Jahan
Boss
(
16.3k
points)

4.8k
views
gate2005it
datastructures
stack
normal
+43
votes
3
answers
26
GATE2008IT51
Consider the C program given below. What does it print? #include <stdio.h> int main () { int i, j; int a [8] = {1, 2, 3, 4, 5, 6, 7, 8}; for(i = 0; i < 3; i++) { a[i] = a[i] + 1; i++; } i; for (j = 7; j > 4; j) { int i = j/2; a[i] = a[i]  1; } printf ("%d, %d", i, a[i]); } $2, 3$ $2, 4$ $3, 2$ $3, 3$
asked
Oct 29, 2014
in
Programming
by
Ishrat Jahan
Boss
(
16.3k
points)

3.8k
views
gate2008it
programming
programminginc
normal
+42
votes
6
answers
27
GATE2015133
Consider the following pseudo code, where $x$ and $y$ are positive integers. begin q := 0 r := x while r ≥ y do begin r := r  y q := q + 1 end end The post condition that needs to be satisfied after the program terminates is $\{ r = qx + y \wedge r < y\}$ $\{ x = qy + r \wedge r < y\}$ $\{ y = qx + r \wedge 0 < r < y\}$ $\{ q + 1 < r  y \wedge y > 0\}$
asked
Feb 13, 2015
in
Programming
by
makhdoom ghaya
Boss
(
30.9k
points)

3.9k
views
gate20151
programming
loopinvariants
normal
+42
votes
11
answers
28
GATE19941.11
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$ ... new representation is: $i+j$ $i+j1$ $(j1)+\frac{i(i1)}{2}$ $i+\frac{j(j1)}{2}$
asked
Oct 4, 2014
in
DS
by
Kathleen
Veteran
(
52.2k
points)

7k
views
gate1994
datastructures
arrays
normal
+42
votes
3
answers
29
GATE200747
Consider the process of inserting an element into a $Max \: Heap$, where the $Max \: Heap$ is represented by an $array$. Suppose we perform a binary search on the path from the new leaf to the root to find the position for the newly inserted element, the number of $comparisons$ performed is: $\Theta(\log_2n)$ $\Theta(\log_2\log_2n)$ $\Theta(n)$ $\Theta(n\log_2n)$
asked
Sep 22, 2014
in
DS
by
Kathleen
Veteran
(
52.2k
points)

5.2k
views
gate2007
datastructures
heap
normal
+41
votes
9
answers
30
GATE2017255
Consider the following C program. #include<stdio.h> #include<string.h> int main() { char* c=”GATECSIT2017”; char* p=c; printf(“%d”, (int)strlen(c+2[p]6[p]1)); return 0; } The output of the program is _______
asked
Feb 14, 2017
in
Programming
by
Madhav
Active
(
1.6k
points)

9.3k
views
gate20172
programminginc
numericalanswers
Page:
1
2
3
4
5
6
...
165
next »
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
ISRO CSE 2020 PAPER ANALYSE
BARC OCES/DGFS 2020
ISI CMI PDF by GATE Overflow
Calculus Important Points
Management Trainee Recruitment COAL INDIA 2020
All categories
General Aptitude
1.9k
Engineering Mathematics
7.5k
Digital Logic
2.9k
Programming and DS
4.9k
Programming
3.5k
DS
1.3k
Algorithms
4.4k
Theory of Computation
6.2k
Compiler Design
2.1k
Operating System
4.5k
Databases
4.1k
CO and Architecture
3.4k
Computer Networks
4.2k
Non GATE
1.4k
Others
1.4k
Admissions
595
Exam Queries
573
Tier 1 Placement Questions
23
Job Queries
72
Projects
18
Follow @csegate
Recent Blog Comments
Shut the f up and study.. If u get to the...
@ Vignaneswarkrishna .... do you know...
@devendhar, yes ....great chances of...
Cut off will be between 95115. But not more than...
@saransh0 ...... I am getting 108... is there any...
50,737
questions
57,394
answers
198,594
comments
105,446
users