Your SlideShare is downloading. ×
0
Double-Ended Queue A Deque or deck is a double-ended queue. Allows elements to be added or removed on either the ends.
TYPES OF DEQUE Input restricted Deque Elements can be inserted only at one end. Elements can be removed from both the e...
Deque as Stack and QueueAs STACK When insertion and deletion is made at the same side.As Queue When items are inserted a...
OPERATIONS IN DEQUE Insert element at back Insert element at front Remove element at front Remove element at back
Insert_front insert_front() is a operation used to push an element into the  front of the Deque.      PUSH 0           1 ...
Algorithm Insert_frontstep1. Startstep2. Check the queue is full or not as if (r == max-1) &&(f==0)step3. If false update ...
Insert_back insert_back() is a operation used to push an element at the  back of a Deque.                     1    2     ...
Alogrithm insert_backStep1: StartStep2: Check the queue is full or not as if (r == max-1)       &&(f==0) if yes queue is f...
Remove_front remove_front() is a operation used to pop an element on front  of the Deque.            POP       1   2     ...
Alogrithm Remove_frontStep1: StartStep2: Check the queue is empty or not as if (f == r) if yes queue is        empty.Step3...
Remove_back• remove_front() is a operation used to pop an element on frontof the Deque.                     1   2       3 ...
Alogrithm Remove_backstep1. Startstep2. Check the queue is empty or not as if (f == r) if yes queue                       ...
Empty It is used to test weather the Deque is empty or not.
APPLICATIONS OF DEQUEPalindrome-checker
APPLICATIONS OF DEQUEA-Steal job scheduling algorithm The A-Steal algorithm implements task scheduling for several  proce...
OTHER APPLICATIONS OF DEQUE Undo-Redo operations in Software applications.
Thank You
Deque and its applications
Upcoming SlideShare
Loading in...5
×

Deque and its applications

618

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
618
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
17
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Deque and its applications"

  1. 1. Double-Ended Queue A Deque or deck is a double-ended queue. Allows elements to be added or removed on either the ends.
  2. 2. TYPES OF DEQUE Input restricted Deque Elements can be inserted only at one end. Elements can be removed from both the ends. Output restricted Deque Elements can be removed only at one end. Elements can be inserted from both the ends.
  3. 3. Deque as Stack and QueueAs STACK When insertion and deletion is made at the same side.As Queue When items are inserted at one end and removed at the other end.
  4. 4. OPERATIONS IN DEQUE Insert element at back Insert element at front Remove element at front Remove element at back
  5. 5. Insert_front insert_front() is a operation used to push an element into the front of the Deque. PUSH 0 1 2 3 4 5 7 FRONT REAR 0 1 2 3 4 5 7
  6. 6. Algorithm Insert_frontstep1. Startstep2. Check the queue is full or not as if (r == max-1) &&(f==0)step3. If false update the pointer f as f= f-1step4. Insert the element at pointer f as Q[f] = elementstep5. Stop
  7. 7. Insert_back insert_back() is a operation used to push an element at the back of a Deque. 1 2 3 4 5 7 PUSH 9 FRONT REAR 1 2 3 4 5 7
  8. 8. Alogrithm insert_backStep1: StartStep2: Check the queue is full or not as if (r == max-1) &&(f==0) if yes queue is fullStep3: If false update the pointer r as r= r+1Step4: Insert the element at pointer r as Q[r] = elementStep5: Stop
  9. 9. Remove_front remove_front() is a operation used to pop an element on front of the Deque. POP 1 2 3 4 5 7 FRONT REAR 2 3 4 5 7
  10. 10. Alogrithm Remove_frontStep1: StartStep2: Check the queue is empty or not as if (f == r) if yes queue is empty.Step3: If false update pointer f as f = f+1 and delete element at position f as element = Q[f]Step4: If ( f== r) reset pointer f and r as f = r = -1Step5: Stop
  11. 11. Remove_back• remove_front() is a operation used to pop an element on frontof the Deque. 1 2 3 4 5 7 POP FRONT REAR 1 2 3 4 5
  12. 12. Alogrithm Remove_backstep1. Startstep2. Check the queue is empty or not as if (f == r) if yes queue is emptystep3. If false delete element at position r as element = Q[r]step4. Update pointer r as r = r-1step5. If (f == r ) reset pointer f and r as f = r= -1step6. Stop
  13. 13. Empty It is used to test weather the Deque is empty or not.
  14. 14. APPLICATIONS OF DEQUEPalindrome-checker
  15. 15. APPLICATIONS OF DEQUEA-Steal job scheduling algorithm The A-Steal algorithm implements task scheduling for several processors(multiprocessor scheduling). The processor gets the first element from the deque. When one of the processor completes execution of its own threads it can steal a thread from another processor. It gets the last element from the deque of another processor and executes it.
  16. 16. OTHER APPLICATIONS OF DEQUE Undo-Redo operations in Software applications.
  17. 17. Thank You
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×