Double Ended Queue
Double ended queue is a more generalized form of queue data structure which allows insertion and removal of elements from both the ends, i.e , front and back.
Implementation of Double ended Queue
Here we will implement a double ended queue using a circular array. It will have the following methods:
- push_back : inserts element at back
- push_front : inserts element at front
- pop_back : removes last element
- pop_front : removes first element
- get_back : returns last element
- get_front : returns first element
- empty : returns true if queue is empty
- full : returns true if queue is full
No comments:
Post a Comment