Search

Sunday, March 16, 2014
0 comments

Double Ended Queue (DEQUE) in 'C'

1:35 AMSunday, March 16, 2014

Double Ended Queue (DEQUE)

DEQUE (pronounced as deck), Double Ended Queue, is a type of Queue in which additions and deletion are deletions are done from both the ends. So it is called as Double Ended Queue.

DEQUEs are of two types.

1. Input restricted DEQUE:
                        In this type of Double Ended Queue, the ADD (insertion) Operation is restricted to one end and the DELETE operation is done from both the ends. Only REAR is used for insertion operation and both FORNT and REAR are used for deletion operation. When an item is added REAR is updated accordingly and the item is inserted at REAR index. When an item is deleted from the FRONT end, FRONT is updated accordingly FRONT<--FRONT+1. When an item is deleted from REAR end, REAR is updated as REAR<--REAR-1.

2. Output restricted DEQUE:
                        It is opposite of Input restricted DEQUE. In this type Double Ended Queue, the DELETE operation is restricted to one end the insertion (ADD) operation is done to both the ends. Only FRONT is used for DELETE operation and both FRONT and REAR are used for ADD operation. When an item is added to the FRONT end, FRONT is updated accordingly FRONT<--FRONT-1, and the item is inserted at FRONT index. When an item is added to the item is inserted at REAR Index.

Protected by Copyscape Online Copyright Protection Software

0 comments :

Post a Comment

 
Toggle Footer
Top