Complexity and arrays
Identify input size, count the dominant work, and distinguish time from extra memory. Indexed array access is fast, while inserting in the middle usually shifts later elements. Big-O describes growth, not wall-clock seconds.
View key idea and practice
An algorithm is a finite sequence of steps for solving a problem. Big-O notation describes how resource use grows as input size grows, while an array stores indexed elements in contiguous logical order.
Worked exampleA one-pass scan for a target visits at most each array item, so its work grows linearly with the number of items.
Try itCompare scanning an unsorted list with looking up an index in an array. State the assumption behind each cost.
Suggested checkIndex access is constant-time under the usual array model. A value search in an unsorted array is linear because the target may be last or absent.