Arrays

Problem shape

Beginner
4
8
15
16
23
42
Core idea

Visit every element once from left to right.

Step 1 / 5
Problem shape
Current lesson

Array Traversal Lab

Arrays Beginner

Array Traversal

Welcome to the Array Traversal algorithm lab. Visit every element once from left to right. Use it when: Use as the base pattern for counting, filtering, transforming, and scanning arrays. The time complexity is O(n), and the space complexity is O(1). The pseudocode is: for i from 0 to n - 1 visit a[i] As you practice, track the state that changes and the condition that makes the algorithm stop.

Time

O(n)

Space

O(1)

Pseudocode

for i from 0 to n - 1
  visit a[i]
Open deeper structure lesson
1.0x