Skip to content

Glossary: Data Structures and Algorithms in Go

Capacity

Also written: cap, cap(items)

The number of slots in the array behind a slice, found with `cap`. When length reaches capacity, `append` allocates a bigger array and copies the items over.

Where the book teaches it

Related terms

SliceAmortized O(1)Array