# Data types & structures

> CIE A-Level Computer Science · 9618
> Source: https://www.owlsprep.com/study/cie-9618-u10-overview/
> Weight: n/a

This unit introduces core data types and common data structures for programming, covering how data is organized, stored, and manipulated to solve computational problems efficiently.

**Prerequisites:** Basic programming fundamentals: variables, algorithms, and control flow

## Learning objectives

- Distinguish between primitive and composite data types used in programming
- Implement and apply common linear and non-linear data structures for different problem scenarios
- Analyze time and space tradeoffs between different data structures
- Select the appropriate data structure to solve a given computational problem efficiently

## Unit at a glance

This unit progresses from the most basic building blocks of data (primitive types) up to increasingly complex composite structures used to solve real-world computational problems. We first cover fundamental linear structures, then move to non-linear structures that model more complex relationships between data.

Mastery of this topic is critical for writing efficient code and answering problem-solving questions across the entire CIE 9618 syllabus. The choice of data structure directly impacts the efficiency of any algorithm you implement.

Below are all sub-topics covered in this unit, ordered from foundational to advanced:
- [Primitive data types](https://www.owlsprep.com/study/cie-9618-u10-primitive-data-types/) — Foundational single-value atomic data types built into most programming languages.
- [Arrays](https://www.owlsprep.com/study/cie-9618-u10-arrays/) — Linear collections of homogeneous data with static or dynamic sizing.
- [Records](https://www.owlsprep.com/study/cie-9618-u10-records/) — Composite data types that group heterogeneous related data fields.
- [Linked lists](https://www.owlsprep.com/study/cie-9618-u10-linked-lists/) — Dynamic linear structures made of nodes connected by pointers/references.
- [Stacks](https://www.owlsprep.com/study/cie-9618-u10-stacks/) — Last-in-first-out (LIFO) linear structure with common practical applications.
- [Queues](https://www.owlsprep.com/study/cie-9618-u10-queues/) — First-in-first-out (FIFO) linear structure for ordered processing of data.
- [Trees](https://www.owlsprep.com/study/cie-9618-u10-trees/) — Hierarchical non-linear structure for modeling nested data relationships.
- [Graphs](https://www.owlsprep.com/study/cie-9618-u10-graphs/) — Non-linear structure for modeling networks and connections between nodes.
- [Hash tables](https://www.owlsprep.com/study/cie-9618-u10-hash-tables/) — Structure for efficient key-value lookup using hashing functions.

## Common pitfalls

- **Wrong:** Confusing stack and queue order of operations
  - Why it fails: Mixing up LIFO vs FIFO leads to incorrect solutions for common problems like expression evaluation.
  - Correct: Remember: Stack = Last In First Out (like a plate stack), Queue = First In First Out (like a checkout line).
- **Wrong:** Selecting a data structure without evaluating tradeoffs
  - Why it fails: Arrays have fast access but slow insertion, while linked lists are the opposite, leading to inefficient solutions.
  - Correct: Always check what operations you will perform most before selecting a data structure.
- **Wrong:** Treating all data structures as linear
  - Why it fails: Incorrect classification of trees and graphs leads to wrong traversal logic and property answers.
  - Correct: Always first classify a structure as linear or non-linear when analyzing its behavior.

## Cheatsheet

| Concept | Key Rule / Definition |
| --- | --- |
| Primitive data types | Atomic single-value types: integer, float, boolean, character |
| Static array access | Random access to any element takes $O(1)$ time |
| Linked list insertion | Insertion/deletion at a known node takes $O(1)$ time |
| Stack property | Follows Last-In-First-Out (LIFO) access order |
| Queue property | Follows First-In-First-Out (FIFO) access order |
| Binary tree rule | Each node can have at most 2 child nodes (left and right) |
| Graph storage | Commonly stored as an adjacency matrix or adjacency list |
| Hash table average lookup | Average case key lookup takes $O(1)$ time |
| Record definition | Composite type that stores multiple heterogeneous related fields |

## What's next

Start with the first sub-topic of this unit, which covers primitive data types — the foundational building blocks for all other data structures you will learn in this unit. Once you complete all sub-topics here, move on to the next unit on algorithms to see how these data structures are used to solve common computational problems.

- [Primitive data types (first sub-topic of this unit)](https://www.owlsprep.com/study/cie-9618-u10-primitive-data-types/)
- [Arrays](https://www.owlsprep.com/study/cie-9618-u10-arrays/)
- [Records](https://www.owlsprep.com/study/cie-9618-u10-records/)

---

From [OwlsPrep](https://www.owlsprep.com) — free study guides for A-Level, IB, AP and IGCSE, written against the official syllabus. Canonical page: https://www.owlsprep.com/study/cie-9618-u10-overview/
