Linear structure
A data structure where elements go one after another, in a single line: each has at most one previous and one next.
Example
Arrays, linked lists, stacks and queues are linear. In a line of 20 elements, the 10th has the 9th before and the 11th after.
Test yourself: Linear structure
Types of structures
Which of these is a linear structure?
In a stack of 5 plates each one is on top of just 1 and under just 1: a single line. A tree branches out.
0/1
â–¶ PlayLessons that use it
Big O notation
How much does it grow?
Time complexity
Count steps, not seconds
Types of structures
How they relate and where they live
Arrays
Adjacent cells
Hash collisions
When 2 keys want the same spot
Graphs
Points and connections
Binary search in depth
2 pointers closing in
Choosing how to search
Brute force or using the order
Bucket sort
Split into buckets and sort each one
