Skills101
← Tech dictionary

Data structures & algorithms

What is Array?

An array is a collection of elements stored in contiguous memory and accessed by an index. Reading or writing an element by index takes O(1) time, but inserting or deleting in the middle takes O(n) because elements must shift.

Example

marks[2] returns the third mark in O(1) time.

Learn it properlyDSA tutorials — free, with diagrams, quizzes and a certificate

Related terms