Title | 05.1 Double-ended queue - Insertion and deletion algorithms |
---|---|
Author | Steve Holt |
Course | Intensive Programming |
Institution | Western Illinois University |
Pages | 2 |
File Size | 74 KB |
File Type | |
Total Downloads | 87 |
Total Views | 136 |
CS 500 - Intensive Programming, taught by Professor Sen Nilanjan...
Double-ended queue (Deque) dequeue -> Removes the first element from the queue deque (Deck) -> Double-ended queue (Insertion & deletion at both ends) Initial value of front and rear is -1, that means the queue is empty. If the first element is inserted, then front = rear = 0, irrespective of the insertion. Assuming deque has N cells, and size represents the number of elements in deque. Initial value of size is 0. Insert-at-rear: a) Check whether deque is full or not. If full, then insertion is not possible. b) If rear = -1 //First element front...