Array

Also known as: list, collection

structure

An ordered collection of values stored together and accessed by their numeric index position. Essential for handling lists, sequences, and collections of data.

๐Ÿ’ก Intuition

A numbered list. Item 0, item 1, item 2... Access any by its number.

Core Idea

Arrays store multiple related values under one name, making it easy to iterate over them all.

๐Ÿ”ฌ Example

scores = [95, 87, 92]. scores[0] gives 95; scores[2] gives 92. Index selects the position.

๐ŸŽฏ Why It Matters

Essential for handling lists, sequences, and collections of data.

โš ๏ธ Common Confusion

Most languages index from 0, not 1. The last element of a 3-item array is at index 2.

Related Concepts

How Array Connects to Other Ideas

To understand array, you should first be comfortable with variable and data types. Once you have a solid grasp of array, you can move on to iteration, searching and sorting.

Go Deeper

Frequently Asked Questions

What is Array in CS Thinking?

An ordered collection of values stored together and accessed by their numeric index position.

Why is Array important?

Essential for handling lists, sequences, and collections of data.

What do students usually get wrong about Array?

Most languages index from 0, not 1. The last element of a 3-item array is at index 2.

What should I learn before Array?

Before studying Array, you should understand: variable, data types.

๐Ÿ’ป Animated Visualization Animated

Access elements by their index position