Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Filter
Profile
Wall
Recent activity
All questions
All answers
Exams Taken
All Blogs
Recent activity by HvnCool
5
answers
1
GATE CSE 2004 | Question: 32
Consider the following program fragment for reversing the digits in a given integer to obtain a new integer. Let $n = d_1\, d_2\, \ldots\, d_m$. int n, rev; rev = 0; while(n > 0) { rev = rev * 10 + n%10; n = n/10; } The loop invariant condition at the end ... $n=d_1\, d_2 \,\ldots\, d_m \qquad \mathbf{or} \qquad \text{rev} =d_m \,\ldots\, d_2\, d_1$
Consider the following program fragment for reversing the digits in a given integer to obtain a new integer.Let $n = d_1\, d_2\, \ldots\, d_m$.int n, rev; rev = 0; while(...
12.3k
views
commented
Jun 5, 2016
Programming in C
gatecse-2004
programming
loop-invariants
normal
+
–
4
answers
2
GATE CSE 2008 | Question: 62
The following C function takes a single-linked list of integers as a parameter and rearranges the elements of the list. The function is called with the list containing the integers $1, 2, 3, 4, 5, 6, 7$ in the given order. What will be the contents of the list after function completes execution? struct ... $1, 3, 2, 5, 4, 7, 6$ $2, 3, 4, 5, 6, 7, 1$
The following C function takes a single-linked list of integers as a parameter and rearranges the elements of the list. The function is called with the list containing th...
19.4k
views
comment edited
Jun 3, 2016
DS
gatecse-2008
data-structures
linked-list
normal
+
–
7
answers
3
GATE CSE 2015 Set 1 | Question: 33
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\}$ ... $\{ y = qx + r \wedge 0 < r < y\}$ $\{ q + 1 < r - y \wedge y > 0\}$
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 endThe post condition tha...
15.8k
views
commented
Jun 2, 2016
Programming in C
gatecse-2015-set1
programming
loop-invariants
normal
+
–
4
answers
4
what will be the time complexity for the below question ?
Let an array A[1,....n] has n elements, and every element of an array is less than or equal to n. An element is said to be "majority element" if it is occurred in more than n/2 positions of an array. what is the time complexity to check whether the majority element exist or not?
Let an array A[1,....n] has n elements, and every element of an array is less than or equal to n. An element is said to be "majority element" if it is occurred in more th...
777
views
answered
Mar 29, 2016
Algorithms
algorithms
time-complexity
+
–
3
answers
5
Algorithms
Consider the following code fragment for i=1 to n/2 do for j=i to n-1 do for k=1 to j do output ''foobar'' Assume $n$ is even Let $T(n)$ denote the number of times 'foobar' is printed as a function of $n$. Express $T(n)$ as three nested summations. Simplify the summation. Show your work.
Consider the following code fragment for i=1 to n/2 do for j=i to n-1 do for k=1 to j do output ''foobar''Assume $n$ is even Let $T(n)$ denote the number of times '...
1.4k
views
answer edited
Mar 29, 2016
Algorithms
time-complexity
+
–
7
answers
6
GATE CSE 2002 | Question: 2.12
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 right sub tree. The maximum possible height (number of nodes on the path from the root to the furthest ... which of the following? $\log_2 n$ $\log_{\frac{4}{3}} n$ $\log_3 n$ $\log_{\frac{3}{2}} n$
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...
23.6k
views
commented
Mar 29, 2016
DS
gatecse-2002
data-structures
binary-tree
normal
+
–
3
answers
7
Heap Sort
4) The number of elements that can be sorted in Θ(logn) time using heap sort is (A) Θ(1) (B) Θ(sqrt(logn)) (C) Θ(Log n/(Log Log n)) (d) Θ(Log n)
4) The number of elements that can be sorted in Θ(logn) time using heap sort is (A) Θ(1)(B) Θ(sqrt(logn))(C) Θ(Log n/(Log Log n))(d) Θ(Log n)
624
views
answered
Mar 29, 2016
Algorithms
time-complexity
heap-sort
+
–
0
answers
8
CLRS 8-2 Sorting in place in linear time
Suppose that we have an array of nn data records and that the key of each record has the value 0 or 1. An algorithm for sorting such a set of records might posses some subset of the following three desirable characteristics: The algorithm runs ... algorithm stable? (Hint: How would you do it for k=3? ) Can somebody please provide solution with an example?
Suppose that we have an array of nn data records and that the key of each record has the value 0 or 1. An algorithm for sorting such a set of records might posses some su...
870
views
asked
Mar 22, 2016
Algorithms
sorting
data-structures
+
–
3
answers
9
GATE CSE 2016 Set 2 | Question: 42
Consider the following two statements: If all states of an NFA are accepting states then the language accepted by the NFA is $\Sigma_{}^{*}$. There exists a regular language $A$ such that for all languages $B$, $A \cap B$ is regular. Which one of the following is CORRECT? Only I is true Only II is true Both I and II are true Both I and II are false
Consider the following two statements:If all states of an NFA are accepting states then the language accepted by the NFA is $\Sigma_{}^{*}$.There exists a regular languag...
25.8k
views
commented
Mar 18, 2016
Theory of Computation
gatecse-2016-set2
theory-of-computation
finite-automata
normal
+
–
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register