Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Recent questions tagged queue
0
votes
1
answer
61
Cormen Edition 3 Exercise 10.1 Question 4 (Page No. 235)
Rewrite ENQUEUE and DEQUEUE to detect underflow and overflow of a queue.
Rewrite ENQUEUE and DEQUEUE to detect underflow and overflow of a queue.
akash.dinkar12
563
views
akash.dinkar12
asked
Jun 28, 2019
Algorithms
cormen
data-structures
queue
descriptive
+
–
0
votes
1
answer
62
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]$.
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.hea...
akash.dinkar12
417
views
akash.dinkar12
asked
Jun 28, 2019
Algorithms
cormen
data-structures
queue
descriptive
+
–
0
votes
0
answers
63
Data Structures in C by Sahni - Circular Queue using Dynamic Arrays
I'm learning data structures from a book. In the topic, Circular Queue using Dynamic Array, the author has mentioned below point, Let capacity be the initial capacity of the circular queue,We must first increase the size of ... elements. But how does array doubling and slide to right copy at most 2 * capacity -2 elements??
I'm learning data structures from a book. In the topic, Circular Queue using Dynamic Array, the author has mentioned below point,Let capacity be the initial capacity of t...
Durga Teja
1.5k
views
Durga Teja
asked
Apr 14, 2019
DS
data-structures
queue
+
–
0
votes
1
answer
64
Made easy
Jyoti Kumari97
602
views
Jyoti Kumari97
asked
Jan 28, 2019
Programming in C
data-structures
queue
circular-queue
+
–
0
votes
1
answer
65
Gate cs 2017
A circular queue has been implemented using a singly linked list where each node consists of a value and a single pointer pointing to the next node. We maintain exactly two external pointers FRONT and REAR pointing to the front node and the rear node of the queue, ... node to front. We dont need to do this. So why B is the correct answer?D should be correct ? please explain.
A circular queue has been implemented using a singly linked list where each node consists of a value and a single pointer pointing to the next node. We maintain exactly t...
sadiashafaque
714
views
sadiashafaque
asked
Jan 22, 2019
DS
usergate2017
usermod
queue
+
–
1
votes
1
answer
66
# stacks
How many enqueue and dequeue operations are required to perform a pop operation if Q1 contains n element initially?
How many enqueue and dequeue operations are required to perform a pop operation if Q1 contains n element initially?
amit166
1.4k
views
amit166
asked
Jan 6, 2019
DS
data-structures
stack
queue
+
–
1
votes
1
answer
67
# iit goa data strructre
Assume I have a stack s, a queue q, and a binary search tree t. Initially all of them are empty. Indicate the state of the data structures at line number 7 and at the end. What is the maximum height each of the data structures had during the execution? 1 i $\rightarrow$ 0 2 ... 0 8 while i <= 9 do 9 t.insert(s.pop()) 10 t.insert(q.get()) 11 i $\rightarrow$ i + 1 12 end
Assume I have a stack s, a queue q, and a binary search tree t. Initially all of them are empty. Indicate the state of the data structures at line number 7 and at the end...
amit166
510
views
amit166
asked
Jan 4, 2019
DS
queue
stack
+
–
2
votes
2
answers
68
Stack implementation by using queue
true/false ? ) if stack is implemented as a array,all operation push ,pop ,is emptystack(),delete stack() can be performed in constant time. )if stack is implemented as a linked list ,all operation ,is emptystack(),delete stack() can be performed in constant time.
true/false ?) if stack is implemented as a array,all operation push ,pop ,is emptystack(),delete stack() can be performed in constant time.)if stack is implemented as a l...
Gurdeep Saini
1.4k
views
Gurdeep Saini
asked
Jan 2, 2019
Programming in C
data-structures
queue
stack
+
–
0
votes
0
answers
69
Gateforum Class Notes
The array implementation of Queue throws an error when the array limit has been reached. So we consider the following alternative. Create a larger array using redefine function. The cost of the redefine that makes the array larger is proportional to the new size. Suppose we expand the array ... $N$ insertions will take. $O(N^2)$ $O(N^3)$ $O(N)$ $O(log_2N)$ Answer provided: $A$
The array implementation of Queue throws an error when the array limit has been reached. So we consider the following alternative.Create a larger array using redefine fun...
Gupta731
514
views
Gupta731
asked
Dec 23, 2018
DS
data-structures
queue
+
–
0
votes
0
answers
70
Priority Queue
Is priority queue work efficiently with sorted array than unsorted array and heap for insertion and deletion operation? Then why do we apply priority queue in heap specially
Is priority queue work efficiently with sorted array than unsorted array and heap for insertion and deletion operation? Then why do we apply priority queue in heap specia...
srestha
597
views
srestha
asked
Dec 22, 2018
DS
data-structures
priority-queue
queue
+
–
2
votes
3
answers
71
NIELIT 2018-69
____ number of queues are needed to implement a stack $1$ $2$ $3$ $4$
____ number of queues are needed to implement a stack$1$$2$$3$$4$
Arjun
3.2k
views
Arjun
asked
Dec 7, 2018
DS
nielit-2018
data-structures
queue
+
–
0
votes
1
answer
72
conceptual doubt
WHAT IS THE TIME COMPLEXITY TO ENQUEUE AN ELEMENT IF THE QUEUE IS IMPLEMENTED AS A CIRCULAR QUEUE AND WE HAVE GOT ONLY ONE POINTER TO FRONT ELEMENT??
WHAT IS THE TIME COMPLEXITY TO ENQUEUE AN ELEMENT IF THE QUEUE IS IMPLEMENTED AS A CIRCULAR QUEUE AND WE HAVE GOT ONLY ONE POINTER TO FRONT ELEMENT??
sushmita
1.3k
views
sushmita
asked
Sep 20, 2018
DS
data-structures
linked-list
time-complexity
queue
+
–
0
votes
0
answers
73
#self doubt
1) How many stacks are needed to implement a queue . 2) How many queue are needed to implement a stack.
1) How many stacks are needed to implement a queue .2) How many queue are needed to implement a stack.
Shubham Aggarwal
251
views
Shubham Aggarwal
asked
Aug 30, 2018
DS
queue
+
–
0
votes
1
answer
74
MadeEasy Workbook
https://gateoverflow.in/?qa=blob&qa_blobid=11435838562783483664 Approach for Q9 please . (Please note: it is the last question on left hand side, and part of it is written on right hand side) Answer is d, but according to me it should be b as in 3 ... but won't be restored in it's original state as mentioned in question. So only 1 and 2 is possible. Is it correct?
https://gateoverflow.in/?qa=blob&qa_blobid=11435838562783483664Approach for Q9 please .(Please note: it is the last question on left hand side, and part of it is written ...
manvi_agarwal
2.0k
views
manvi_agarwal
asked
Jul 30, 2018
DS
made-easy-booklet
data-structures
queue
see-later
+
–
0
votes
1
answer
75
MadeEasy Workbook: Programming & DS - Queues
https://gateoverflow.in/?qa=blob&qa_blobid=10936115150698131975
https://gateoverflow.in/?qa=blob&qa_blobid=10936115150698131975
manvi_agarwal
324
views
manvi_agarwal
asked
Jul 29, 2018
DS
made-easy-workbook
data-structures
queue
+
–
1
votes
2
answers
76
Self doubt
What are the minimum number of pointers required to implement a stack using single ended queue ( the queue is NOT a dequeue )?
What are the minimum number of pointers required to implement a stack using single ended queue ( the queue is NOT a dequeue )?
kapilbk1996
1.1k
views
kapilbk1996
asked
Jul 26, 2018
DS
stack
queue
data-structures
pointers
+
–
1
votes
0
answers
77
Implementation of Stack and Queue
In implementation of queue using stack, deletion of second element from front take Ο(n) time, when insertion take Ο(1) time. Is it a true statement ? Well it can be true isn't it ? because suppose elements come we simply push them without taking care ... to stack1. dnQueue(q) 1) If stack1 is empty then error 2) Pop an item from stack1 and return it Am i right?
In implementation of queue using stack, deletion of second element from front take Ο(n) time, when insertion take Ο(1) time.Is it a true statement ?Well it can be true ...
Na462
1.8k
views
Na462
asked
May 5, 2018
Programming in C
data-structures
queue
stack
+
–
0
votes
1
answer
78
GATE 2013
Its GATE 2013 question 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 ... performed on non-empty or full queue?? Due to this change will the answer remain same?? Θ(n) Θ(n + k) Θ(nk) Θ(n2)
Its GATE 2013 questionConsider the following operation along with Enqueue and Dequeue operations on queues, where kis a global parameter. MultiDequeue(Q){ m = k while (Q ...
!KARAN
1.0k
views
!KARAN
asked
Apr 30, 2018
DS
queue
+
–
2
votes
2
answers
79
#Test_Series
Consider implementation of stack using queue by following algorithm. Let $x$ be an element to be pushed in the stack push(q1,x) { EQ(q1,x) while(q1 does not contain 1 element) { k=DQ(q1) EQ(q1,k) } } pop(q1) { DQ(q1) } How many enqueue and dequeue operations required to push $2$ and pop $2$ elements in the empty stack?
Consider implementation of stack using queue by following algorithm.Let $x$ be an element to be pushed in the stackpush(q1,x) { EQ(q1,x) while(q1 does not contain 1 eleme...
himgta
872
views
himgta
asked
Apr 30, 2018
DS
data-structures
stack
queue
+
–
1
votes
1
answer
80
Stack and queue
Hi please verify me We can implement a stack using only one queue. Like first insert into queue and for popping a element from stack dequeue n-1 element from queue and enque into queue and then pop last element and do the same each time......try it and verify that I am right or wrong?
Hi please verify meWe can implement a stack using only one queue.Like first insert into queue and for popping a element from stack dequeue n-1 element from queue and enqu...
Ravi prakash pandey
1.1k
views
Ravi prakash pandey
asked
Apr 7, 2018
Programming in C
data-structures
queue
stack
+
–
36
votes
6
answers
81
GATE CSE 2018 | Question: 3
A queue is implemented using a non-circular singly linked list. The queue has a head pointer and a tail pointer, as shown in the figure. Let $n$ denote the number of nodes in the queue. Let 'enqueue' be implemented by inserting a new node at the head, and 'dequeue' ... $\Theta(1), \Theta(n)$ $\Theta(n), \Theta(1)$ $\Theta(n), \Theta(n)$
A queue is implemented using a non-circular singly linked list. The queue has a head pointer and a tail pointer, as shown in the figure. Let $n$ denote the number of node...
gatecse
15.3k
views
gatecse
asked
Feb 14, 2018
DS
gatecse-2018
algorithms
data-structures
queue
normal
linked-list
1-mark
+
–
2
votes
3
answers
82
#Push & #Pop
A queue is implemented using two stacks S1 and S2. Initially the queue contains 1, 2, 3, 4 from front to rear. The following operations are performed in the queue: delete, insert (5), delete, Then how many total no. of push and pop operations are needed to perform the above operation? a) Push: 12 Pop: 13 b) Push: 15 Pop: 16 c) Push: 11 Pop: 10 d) Push: 12 Pop: 11
A queue is implemented using two stacks S1 and S2. Initially the queue contains 1, 2, 3, 4 from front to rear. The following operations are performed in the queue: delete...
Tuhin Dutta
1.0k
views
Tuhin Dutta
asked
Jan 31, 2018
DS
data-structures
stack
queue
+
–
3
votes
5
answers
83
MadeEasy Test Series 2018: Programming & DS - Stack
Consider the following statements: S1: If stack is implemented as an array, all the operation push, pop, is_empty stack ( ), delete stack ( ) can be performed in constant time. S2: If stack is implemented as a linked list, ... S4: Circular queues can be implemented with the help of the stack data structure. Which of the following option is false?
Consider the following statements:S1: If stack is implemented as an array, all the operation push, pop, is_empty stack ( ), delete stack ( ) can be performed in constant ...
Rishabh Gupta 2
2.8k
views
Rishabh Gupta 2
asked
Jan 23, 2018
DS
data-structures
stack
queue
made-easy-test-series
+
–
4
votes
1
answer
84
Implementation of queue using stack
In implementation of queue using stack, deletion of second element from front take Ο(1) time, when insertion take Ο(n) time. Which of the following is correct ? True / False
In implementation of queue using stack, deletion of second element from front take Ο(1) time, when insertion take Ο(n) time.Which of the following is correct ?True / Fa...
Hemant Parihar
1.5k
views
Hemant Parihar
asked
Jan 20, 2018
DS
data-structures
queue
time-complexity
true-false
+
–
1
votes
1
answer
85
MadeEasy Test Series 2018: Programming & DS - Queues
Can someone explain the solution along with a picture of how the steps are taking place?
Can someone explain the solution along with a picture of how the steps are taking place?
Kalpataru Bose
458
views
Kalpataru Bose
asked
Jan 19, 2018
DS
made-easy-test-series
programming-in-c
queue
+
–
3
votes
3
answers
86
Implementation of stack using queues
What are the minimum enqueue and dequeue operations needed to perform pop operation for a stack which is implemented with two queues if there are already 10 elements in the first queue?
What are the minimum enqueue and dequeue operations needed to perform pop operation for a stack which is implemented with two queues if there are already 10 elements in t...
Ibtisam Sayyad
7.9k
views
Ibtisam Sayyad
asked
Jan 12, 2018
DS
data-structures
stack
queue
+
–
4
votes
1
answer
87
made easy test series
Consider the following statements: S1 : Implementation of stack using queue, deletion of second element from top of stack time complexity Ο(n), when insertion take Ο(1) time. S2 : In implementation of queue using stack, deletion of second element from front take Ο(1) time, when insertion take Ο(n) time. Which of the following is correct ?
Consider the following statements:S1 : Implementation of stack using queue, deletion of second element from top of stack time complexity Ο(n), when insertion take Ο(1) ...
chandra sai
3.3k
views
chandra sai
asked
Jan 3, 2018
Programming in C
stack
queue
data-structures
+
–
0
votes
1
answer
88
Queue
Consider the following statements: S1 : Implementation of stack using queue, deletion of second element from top of stack time complexity Ο(n), when insertion take Ο(1) time. S2 : In implementation of queue using stack, deletion of second element from front take Ο(1) time, when insertion take Ο(n) time. Why both statements are correct
Consider the following statements:S1 : Implementation of stack using queue, deletion of second element from top of stack time complexity Ο(n), when insertion take Ο(1) ...
Shivi rao
908
views
Shivi rao
asked
Dec 12, 2017
Programming in C
queue
data-structures
+
–
3
votes
1
answer
89
Queues using stacks
PLEASE PROVIDE SOURCE FOR THIS CONCEPT Suppose that queue operations are implemented using stack operation. enqueue(x) and Dequeue( ) are queue operations whereas Pop( ) and Push(x) are stack operations. Consider the following code Enqueue(S1,x){ Push(S1,x); } Dequeue(S1,S2){ if(!IsEmptyStack S2) ... S2)); and S1; (C) Push (S1, Pop (S2)); and S2; (D) Push (S2, Pop (S1)); and S1;
PLEASE PROVIDE SOURCE FOR THIS CONCEPTSuppose that queue operations are implemented using stack operation. enqueue(x) and Dequeue( ) are queue operations whereas Pop( ) a...
Parshu gate
1.8k
views
Parshu gate
asked
Nov 13, 2017
DS
queue
stack
data-structures
+
–
2
votes
1
answer
90
stack operations using queue
Suppose Stack operations are implemented using Queue Operation. Push(x) and Pop() are stack operations whereas enqueue(x) and dequeue are Queue operations. Consider the code: pop() { return Q.dequeue(); } push(x) { n= Q.size(); //Q.size() returns the number of ... operation correctly (A) Q.enqueue(x) (B) Q.enqueue(Q.deqeue()) (C) Q.dequeue(Q.enqueue(x)) (D) Q.dequeue()
Suppose Stack operations are implemented using Queue Operation. Push(x) and Pop() are stack operations whereas enqueue(x) and dequeue are Queue operations.Consider the co...
Parshu gate
1.2k
views
Parshu gate
asked
Nov 11, 2017
DS
data-structures
stack
queue
priority-queue
+
–
Page:
« prev
1
2
3
4
5
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register