![]() Allocating deque contents from the center of the underlying array, and resizing the underlying array when either end is reached.This decreases the frequency of resizings. Storing deque contents in a circular buffer, and only resizing when the buffer becomes full.These array deques have all the properties of a dynamic array, such as constant-time random access, good locality of reference, and inefficient insertion/removal in the middle, with the addition of amortized constant-time insertion/removal at both ends, instead of just one end. ![]() The dynamic array approach uses a variant of a dynamic array that can grow from both ends, sometimes called array deques. There are at least two common ways to efficiently implement a deque: with a modified dynamic array or with a doubly linked list. Names vary between languages major implementations include: Also generally implemented are peek operations, which return the value at that end without dequeuing it. The basic operations on a deque are enqueue and dequeue on either end. Operations UML class diagram of a double-ended queue
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |