1 / 29

Deque In Data Structure | Introduction To Deque With Example | Simplilearn

This presentation on Deque in Data Structures will acquaint you with a clear understanding of how the double-ended queue works. In this Data Structure Tutorial, you will understand circular array implementation n of Deque using the C programming language. Additionally, this tutorial will allow you to understand Introduction to Deque with Example. So, let's get started!<br><br>The topics covered in this presentation are:<br>1. Introduction<br>2. What Is Deque?<br>3. Properties of Deque<br>4. Types of Deque<br>5. Representation of Deque Using Circular Queue<br>6. Different Operations in Deque<br>7. Implementation of Deque

Simplilearn
Download Presentation

Deque In Data Structure | Introduction To Deque With Example | Simplilearn

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. What’s In It for you? What Is Deque? Properties of Deque Types of Deque Representation of Deque Using Circular Queue Different Operations In Deque Implementation of Deque Applications of Deque

  2. What Is Deque?

  3. Click here to watch the video

  4. What Is Deque? • Deque stands for Double Ended Queue. • It is a generalized version of the linear queue in which both the insertion and deletion can be performed at both the ends. Insertion Insertion Deletion Deletion

  5. Properties of Deque

  6. Properties of Deque A deque can perform both the Insertion and Deletion based on the Last In First Out (LIFO) Principle. Insert Delete 2 12 7 3

  7. Properties of Deque A deque can also perform the Insertion and Deletion based on First In First Out (FIFO) Principle. 3 11 9 -2 Insertion 0 1 2 3 4 Deletion

  8. Types of Deque

  9. 1. Input-Restricted Deque The Input-Restricted Deque is a deque that has certain restrictions for inserting an element. In Input restricted deque, the elements can only be inserted from one end, where deletion can happen at both the ends. Insertion Deletion Deletion

  10. 2. Output-Restricted Deque The Output-Restricted Deque is a deque that has certain restrictions for removing an element from deque. In Input restricted deque, the elements can only be removed from one end, where insertion can happen at both the ends. Insertion Insertion Deletion

  11. Think and Answer! Based on the properties of Deque that we have discussed till now. Which of the following data structures will be more ideal to implement it? (Multiple answers can be correct) • Circular Queue (Circular Array) • Singly Linked List • Doubly Linked List

  12. Representation of Deque Using Circular Queue

  13. What is a Circular Queue? A circular queue is an extended version of a linear queue with the exception that the last node of this queue is connected to its first, making a circular link. FRONT REAR 5 0 12 7 -6 1 4 -2 1 7 2 3

  14. What is a Circular Queue? A circular link in a circular queue allows rear node to reach at the beginning of a queue with help of circular incrementation. REAR 0 5 12 0 -6 1 4 Insertion of new element! 1 7 FRONT 2 3

  15. Representation of Deque To implement deque using circular queue, we should be able to perform insertion and deletion at both the ends. FRONT REAR 5 0 7 1 4 -2 7 2 3

  16. Representation of Deque In previous example, we inserted elements from the rear node. Now, we will insert elements using front node. FRONT REAR 5 0 FRONT = MAXSIZE -1 12 7 -6 1 4 -2 7 2 3

  17. Representation of Deque Let’s understand how we can perform deletion at both the nodes. Here, we will perform deletion using front node. FRONT REAR 5 0 12 7 -6 1 4 -2 7 2 3

  18. Representation of Deque Now, we will perform the deletion using a rear node. FRONT REAR 5 0 7 1 4 -2 7 2 3

  19. Different Operations In Deque

  20. Operations In Deque • The basic operations that can be performed on deque are: • Insertion at Front • Deletion at Front • Insertion at Rear • Deletion at Rear • All these operations cost us O(1).

  21. Implementation of Deque

  22. Implementation of Deque Let’s now formulate the code for implementation of Deque using Circular Queue (Array).

  23. Applications of Deque

  24. Palindrome Checker Implementation We can read the string from both the sides of deque. RADAR A D R R A RADAR If reading from both the sides of a deque is equal, then the string is considered to be Palindrome.

  25. Multiprocessor Scheduling P3 Single core processing is not a good option as modern apps require huge computing power. P2 P1 P4 Multiple Processes Single Processor (CPU)

  26. Multiprocessor Scheduling P3 P2 P1 P4 CPU 3 CPU 1 CPU 2 Multiple Processors P1 P2 P3 P4 PN Double Ended Queue

More Related