Jump to content

Monoque

From Wikipedia, the free encyclopedia

A monoque is a linear data structure which provides dynamic array semantics. A monoque is similar in structure to a deque but is limited to operations on one end. Hence the name, mono-que. A monoque offers O(1) random access and O(1) push_back/pop_back. Unlike a C vector, the push_back/pop_back functions are not amortized and are strictly O(1) in time complexity. Because the block list is never reallocated or resized, it maintains strictly O(1) non-amortized worst case performance. Unlike C 's deque, the O(1) performance guarantee includes the time complexity of working with the block list, whereas the C standard only guarantees the deque to be O(1) in terms of operations on the underlying value type.

The monoque consists of a size variable and a fixed-size block list of blocks with exponentially increasing sizes. Thus, the size of the monoque in bits is roughly proportional to the square of the system pointer size. Though arguably O(lg N) in size, because lg(pointer_size) is constant on any particular machine the block list is O(1) in size and is an upper bound to O(lg(N)), it bounds the space complexity of the structure by a constant.