Constant space (source code)

= Constant space
{title2=$O(1)$}

= Constant memory
{synonym}

A <constant space> <algorithm> uses $O(1)$ working storage with respect to the stated input-size parameter. Under a machine-word model, an iterative <binary search> needs only a fixed number of indices, so it uses constant auxiliary words. Under a bit model, indices up to $n$ require $\Theta(\log n)$ bits, so constant words need not mean constant bits. Input and output storage may be excluded by an auxiliary-space convention, which must be stated. Keeping a fixed number of arbitrarily large <integers> is not a constant-bit-space guarantee.