Arrays, records, files, stacks, queues and trees: how data is organised for fast use.
A list of values of the same type, each found by its position (index).
A group of related fields about one thing: name, ID, department.
A collection of records stored on disk, such as a staff file.
Last in, first out (LIFO): like a stack of plates or the Undo button.
First in, first out (FIFO): like a print queue or a call queue.
A hierarchy of parent and child items, such as folders on a drive.
Stack: A
Stack: A, B
Stack: A, B, C
C comes off first. Stack: A, B. This is why Undo removes your most recent change first.
Print queue: Job 1
Print queue: Job 1, Job 2
Print queue: Job 1, Job 2, Job 3
Job 1 prints first. The queue keeps the order fair.
Choose the right group for each item. 6 left to sort
Records are read one after another from the start, like a cassette tape. Good for payroll runs.
Any record can be read immediately using its key or address, like a song on a playlist. Good for lookups.
An index points to where each record is stored, like the index at the back of a book. Databases use indexes for speed.
Which structure works on a first in, first out basis?