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 cormen
0
votes
0
answers
1
Cormen Edition 3 Exercise 10.2 Question 8 (Page No. 241)
Explain how to implement doubly linked lists using only one pointer value $x.np$ per item instead of the usual two (next and prev). Assume that all pointer values can be interpreted as $k$bit integers, and define $x.np$ ... $INSERT$, and $DELETE$ operations on such a list. Also, show how to reverse such a list in $O(1)$ time.
asked
Jun 30
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

64
views
cormen
datastructure
linkedlists
descriptive
difficult
0
votes
0
answers
2
Cormen Edition 3 Exercise 10.2 Question 7 (Page No. 241)
Give a $\Theta(n)$ time nonrecursive procedure that reverses a singly linked list of $n$ elements. The procedure should use no more than constant storage beyond that needed for the list itself.
asked
Jun 30
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

18
views
cormen
datastructure
linkedlists
descriptive
0
votes
0
answers
3
Cormen Edition 3 Exercise 10.2 Question 6 (Page No. 241)
The dynamicset operation $UNION$ takes two disjoint sets $S_1$ and $S_2$ as input, and it returns a set $S=S_1 \cup S_2$ consisting of all the elements of $S_1$ and $S_2$.The sets $S_1$ and $S_2$ are usually destroyed by the operation. Show how to support $UNION$ in $O(1)$ time using a suitable list data structure.
asked
Jun 30
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

6
views
cormen
datastructure
linkedlists
descriptive
0
votes
0
answers
4
Cormen Edition 3 Exercise 10.2 Question 5 (Page No. 240)
Implement the dictionary operations $INSERT$, $DELETE$, and $SEARCH$ using singly linked, circular lists. What are the running times of your procedures?
asked
Jun 30
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

14
views
cormen
datastructure
linkedlists
descriptive
0
votes
0
answers
5
Cormen Edition 3 Exercise 10.2 Question 4 (Page No. 240)
LISTSEARCH’(L, k) 1 x = L.nil.next 2 while x != L.nil and x.key != k 3 x = x.next 4 return x As written, each loop iteration in the LISTSEARCH’ procedure requires two tests: one for $x\neq L.nil$ and one for $x.key\neq k$. Show how to eliminate the test for $x\neq L.nil$ in each iteration.
asked
Jun 30
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

3
views
cormen
datastructure
linkedlists
descriptive
0
votes
1
answer
6
Cormen Edition 3 Exercise 10.2 Question 3 (Page No. 240)
Implement a queue by a singly linked list $L$. The operations of $ENQUEUE$ and $DEQUEUE$ should still take $O(1)$ time.
asked
Jun 30
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

9
views
cormen
datastructure
linkedlists
descriptive
0
votes
0
answers
7
Cormen Edition 3 Exercise 10.2 Question 2 (Page No. 240)
Implement a stack using a singly linked list $L$. The operations $PUSH$ and $POP$ should still take $O(1)$ time.
asked
Jun 30
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

6
views
cormen
datastructure
linkedlists
descriptive
0
votes
0
answers
8
Cormen Edition 3 Exercise 10.2 Question 1 (Page No. 240)
Can you implement the dynamicset operation $INSERT$ on a singly linked list in $O(1)$ time? How about $DELETE$?
asked
Jun 30
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

5
views
cormen
datastructure
linkedlists
descriptive
+1
vote
1
answer
9
Cormen Edition 3 Exercise 10.1 Question 7 (Page No. 236)
Show how to implement a stack using two queues. Analyze the running time of the stack operations.
asked
Jun 28
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

45
views
cormen
datastructure
stack
descriptive
0
votes
0
answers
10
Cormen Edition 3 Exercise 10.1 Question 6 (Page No. 236)
Show how to implement a queue using two stacks. Analyze the running time of the queue operations.
asked
Jun 28
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

12
views
cormen
datastructure
queues
descriptive
0
votes
1
answer
11
Cormen Edition 3 Exercise 10.1 Question 5 (Page No. 236)
Whereas a stack allows insertion and deletion of elements at only one end, and a queue allows insertion at one end and deletion at the other end, a deque (double ended queue) allows insertion and deletion at both ends. Write ... time procedures to insert elements into and delete elements from both ends of a deque implemented by an array.
asked
Jun 28
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

29
views
cormen
algorithms
datastructure
queues
descriptive
0
votes
0
answers
12
Cormen Edition 3 Exercise 10.1 Question 4 (Page No. 235)
Rewrite ENQUEUE and DEQUEUE to detect underflow and overflow of a queue.
asked
Jun 28
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

13
views
cormen
datastructure
queues
descriptive
0
votes
0
answers
13
Cormen Edition 3 Exercise 10.1 Question 3 (Page No. 235)
ENQUEUE(Q, x) 1 Q[Q.tail] = x 2 if Q.tail == Q.length 3 Q.tail = 1 4 else Q.tail = Q.tail + 1 DEQUEUE(Q) 1 x = Q[Q.head] 2 if Q.head == Q.length 3 Q.head = 1 4 else Q.head = Q.head + 1 5 return x illustrate the ... (Q,4),ENQUEUE(Q,1),ENQUEUE(Q,3),DEQUEUE(Q),ENQUEUE(Q,8),DEQUEUE(Q) on an initially empty queue $Q$ stored in array $Q[1...6]$.
asked
Jun 28
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

20
views
cormen
datastructure
queues
descriptive
0
votes
0
answers
14
Cormen Edition 3 Exercise 10.1 Question 2 (Page No. 235)
Explain how to implement two stacks in one array $A[1...n]$ in such a way that neither stack overflows unless the total number of elements in both stacks together is $n$.The $PUSH$ and $POP$ operations should run in $O(1)$ time.
asked
Jun 28
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

17
views
cormen
datastructure
stack
descriptive
0
votes
1
answer
15
Cormen Edition 3 Exercise 10.1 Question 1 (Page No. 235)
STACKEMPTY(S) 1 if S.top == 0 2 return TRUE 3 else return FALSE PUSH(S , x) 1 S.top = S.top + 1 2 S[S.top] = x POP(S) 1 if STACKEMPTY(S) 2 error underflow 3 else S.top = S.top  1 4 return S[S.top + 1] illustrate the result of ... $S$ stored in array $S[1...6]$
asked
Jun 28
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

29
views
cormen
datastructure
stack
descriptive
0
votes
1
answer
16
Cormen Edition 3 Exercise 9.1 Question 2 (Page No. 215)
Prove the lower bound of $\lceil 3n/2\rceil – 2$ comparisons in the worst case to find both the maximum and minimum of $n$ numbers. (Hint: Consider how many numbers are potentially either the maximum or minimum and investigate how a comparison affects these counts.)
asked
Jun 28
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

10
views
cormen
algorithms
descriptive
0
votes
1
answer
17
Cormen Edition 3 Exercise 9.1 Question 1 (Page No. 215)
Show that the second smallest of $n$ elements can be found with $n+\lceil lg\ n \rceil 2$ comparisons in the worst case. (Hint: Also find the smallest element.)
asked
Jun 28
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

14
views
cormen
algorithms
descriptive
0
votes
0
answers
18
Cormen Edition 3 Exercise 8.4 Question 5 (Page No. 204)
A probability distribution function $P(x)$ for a random variable $X$ is defined by $P(x) =Pr\{X\leq x\}$.Suppose that we draw a list of $n$ random variables $X_1,X_2,…,X_n$ from a continuous probability distribution function $P$ that is computable in $O(1)$ time. Give an algorithm that sorts these numbers in linear averagecase time.
asked
Jun 28
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

38
views
cormen
algorithms
sorting
bucketsort
descriptive
difficult
0
votes
0
answers
19
Cormen Edition 3 Exercise 8.4 Question 4 (Page No. 204)
We are given $n$ points in the unit circle, $P_i=(x_i,y_i)$, such that $0<x_i^2+y_i^2<1$ for $i=1,2, .,n$.Suppose that the points are uniformly distributed; that is, the probability of finding a point in ... the origin. (Hint: Design the bucket sizes in BUCKETSORT to reflect the uniform distribution of the points in the unit circle.)
asked
Jun 28
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

14
views
cormen
algorithms
sorting
bucketsort
descriptive
difficult
0
votes
1
answer
20
Cormen Edition 3 Exercise 8.4 Question 3 (Page No. 204)
Let $X$ be a random variable that is equal to the number of heads in two flips of a fair coin. What is $E[X^2]$? What is $E^2[X]$?
asked
Jun 28
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

17
views
cormen
algorithms
sorting
bucketsort
expectation
descriptive
0
votes
0
answers
21
Cormen Edition 3 Exercise 8.4 Question 2 (Page No. 204)
Explain why the worstcase running time for bucket sort is $\Theta(n^2)$. What simple change to the algorithm preserves its linear averagecase running time and makes its worstcase running time $O(n\ lg\ n)$?
asked
Jun 28
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

12
views
cormen
algorithms
sorting
bucketsort
descriptive
0
votes
1
answer
22
Cormen Edition 3 Exercise 8.4 Question 1 (Page No. 204)
BUCKETSORT(A) 1 let B[0...n1] be a new array 2 n = A.length 3 for i  0 to n  1 4 make B[i] an empty list 5 for i = 1 to n 6 insert A[i] into list B[nA[i]] 7 for i = 0 to n  1 8 sort list B[i] with ... ,B[n1] together in order illustrate the operation of BUCKETSORT on the array $A=\langle .79,.13,.16,.64,.39,.20,.89,.53,.71,.42\rangle$
asked
Jun 28
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

14
views
cormen
algorithms
sorting
bucketsort
descriptive
+1
vote
1
answer
23
Cormen Edition 3 Exercise 8.3 Question 4 (Page No. 200)
Show how to sort $n$ integers in the range $0$ to $n^31$ in $O(n)$ time.
asked
Jun 28
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

33
views
cormen
algorithms
sorting
radixsort
descriptive
0
votes
0
answers
24
Cormen Edition 3 Exercise 8.3 Question 3 (Page No. 200)
Use induction to prove that radix sort works. Where does your proof need the assumption that the intermediate sort is stable?
asked
Jun 28
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

7
views
cormen
algorithms
sorting
radixsort
descriptive
0
votes
2
answers
25
Cormen Edition 3 Exercise 8.3 Question 2 (Page No. 200)
Which of the following sorting algorithms are stable: insertion sort, merge sort, heapsort, and quicksort? Give a simple scheme that makes any sorting algorithm stable. How much additional time and space does your scheme entail?
asked
Jun 28
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

21
views
cormen
algorithms
sorting
stablesort
descriptive
0
votes
1
answer
26
Cormen Edition 3 Exercise 8.3 Question 1 (Page No. 199)
RADIXSORT(A, d) 1 for i = 1 to d 2 use a stable sort to sort array A on digit i illustrate the operation of RADIXSORT on the following list of English words: COW, DOG, SEA, RUG, ROW, MOB, BOX, TAB, BAR, EAR, TAR, DIG, BIG, TEA, NOW, FOX.
asked
Jun 28
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

13
views
cormen
algorithms
sorting
radixsort
descriptive
0
votes
0
answers
27
Cormen Edition 3 Exercise 8.2 Question 4 (Page No. 197)
Describe an algorithm that, given $n$ integers in the range $0$ to $k$ preprocesses its input and then answers any query about how many of the $n$ integers fall into the range $[a..b]$ in $O(1)$ time.Your algorithm should use $\Theta(n+k)$ preprocessing time.
asked
Jun 28
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

16
views
cormen
algorithms
sorting
countingsort
descriptive
0
votes
0
answers
28
Cormen Edition 3 Exercise 8.2 Question 3 (Page No. 196)
Suppose that we were to rewrite the for loop header in line $10$ of the COUNTINGSORT as 10 for j = 1 to A.length Show that the algorithm still works properly. Is the modified algorithm stable?
asked
Jun 28
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

6
views
cormen
algorithms
sorting
countingsort
descriptive
0
votes
0
answers
29
Cormen Edition 3 Exercise 8.2 Question 2 (Page No. 196)
Prove that COUNTINGSORT is stable.
asked
Jun 28
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

8
views
cormen
algorithms
sorting
countingsort
descriptive
0
votes
0
answers
30
Cormen Edition 3 Exercise 8.2 Question 1 (Page No. 196)
COUNTINGSORT(A, B, k) 1 let C[0, ,k] be a new array 2 for i = 0 to k 3 C[i] = 0 4 for j = 1 to A.length 5 C[A[j]] = C[A[j]] + 1 6 // C[i] now contains the number of elements equal to i . 7 for i =1 to k 8 C[i] = C[ ... j] 12 C[A[j]] = C[A[j]]  1 illustrate the operation of COUNTINGSORT on the array $A=\langle 6,0,2,0,1,3,4,6,1,3,2 \rangle $
asked
Jun 28
in
Algorithms
by
akash.dinkar12
Boss
(
41.4k
points)

11
views
cormen
algorithms
sorting
countingsort
descriptive
Page:
1
2
3
4
5
6
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
Minimum Number of States in a DFA accepting a binary number divisible by 'n'
GATE 2020 Application Form Opened!
My GATE Preparation Journey
ISI MTECH CS 2019 INTERVIEW EXPERIENCE
IIT HYDERABAD MTECH TA INTERVIEW EXPERIENCE
Follow @csegate
Recent questions tagged cormen
Recent Blog Comments
Feedback for next edition (if ever there's...
Is go book still available,I want to buy it
will pdfs be uploaded ?
50,092
questions
55,255
answers
190,785
comments
86,046
users