Deque का पूरा नाम double ended queue है। यह queue का एक प्रकार है। इसमें हम दोनों ends (front और rear) में insertion और deletion के operations को परफॉर्म कर सकते है। इसका मतलब यह है कि हम front end में insert भी कर सकते है और delete भी। और इसी प्रकार rear end में insert भी कर सकते है और delete भी।
इसको दो प्रकार से प्रस्तुत किया जा सकता है जो कि निम्नलिखित है:-
- Input restricted double ended queue
- Output restricted double ended queue
Input restricted double ended queue
Input restricted double ended queue में, insertion ऑपरेशन को केवल एक end से परफॉर्म किया जा सकता है और deletion ऑपरेशन को दोनों ends से परफॉर्म किया जा सकता है।
Output restricted double ended queue
output restricted double ended queue में, deletion ऑपरेशन को केवल एक end से perform किया जाता है जबकि insertion operation को दोनों ends से परफॉर्म किया जाता है।
Operations of deque
इसमें perform किये जाने वाले basic operation निम्नलिखित है:-
- insertFront() – deque के front में item को add करना।
- insertLast() – deque के rear में एक item को add करना।
- deleteFront() – deque के front से item को delete करना।
- deleteLast() – item के rear से item को delete करना।
इन operations के साथ साथ यह निम्नलिखित operations को भी support करता है:-
getFront():- queue से front item को प्राप्त करना।
getRear():- queue से last item को प्राप्त करना।
isEmpty():- यह check करता है कि deque खाली है या नही।
isFull():- यह check करता है कि deque full है या नही।
Application of deque
इसके अनुप्रयोग निम्नलिखित है:
- इसका प्रयोग steal job scheduling algorithm में किया जाता है।
2. इसका प्रयोग undo और redo के लिए किया जाता है।
3. web browser की history में इसका इस्तेमाल होता है।