Computer Science · Theme B: Computational thinking and problem-solving
B4.1 — Fundamentals of ADTs
Computer Science · SL / HL · syllabus-mapped notes
CS_B4.1.1
Properties and purpose of ADTs
What an ADT is, and how it separates a data structure's behaviour from its implementation.
Full note — freeAn abstract data type (ADT) is a high-level description of a kind of data together with the operations allowed on it, defined by what it does rather than how it is stored. You must be able to explain its properties and purpose. Properties Abstraction: the ADT specifies its behaviour (its operations and their meaning) independently of any concrete implementation. Encapsulation / information hiding: the internal representation is hidden behind a fixed interface , so code that uses the ADT cannot depend on hidden details. Interface vs implementation: the same ADT (for example a list) can be implemented in more than one way (array or linked nodes) without changing how it is used. Purpose Gives a clear, reusable model of data and its operations, letting a programmer reason about and use a structure without knowing its internals. Separates design from implementation, so the underlying storage can be changed or optimized without breaking the rest of the program. e.g. a "list" ADT promises operations such as insert, remove and access-by-position; whether it stores items in an array or in linked nodes is an implementation choice. Do not confuse an ADT (the abstract specification) with a data structure (a concrete way of storing the data in memory that implements it).
CS_B4.1.2
Linked lists evaluated
Singly, doubly and circular lists, their operations, and their trade-offs against arrays.
A linked list is a linear ADT built from nodes , where each node holds a data value and one or more pointers to other nodes, so items need not sit next to each other in memory. You must be able to evaluate the three …
CS_B4.1.3
Constructing linked lists
Node classes and coded insertion, deletion, traversal and search for each list type.
You must be able to construct and apply singly, doubly and circular linked lists in code, with the operations insertion, deletion, traversal and search. Each is built from a small Node class. Singly linked list (one next pointer) class Node: def __init__(self, data): self.data = …
CS_B4.1.4
Binary search trees
The BST ordering property, its node operations, and the three traversals.
A binary search tree (BST) is a tree ADT in which every node has at most two children and obeys an ordering rule, making it efficient for organizing and searching data. You must be able to explain its structure and properties. Ordering property For any …
CS_B4.1.5
Sets as an ADT
Unordered, unique elements with union, intersection, difference and membership code.
A set is an ADT that stores a collection of unique elements with no order : an element is either in the set or not, and duplicates are ignored. You must be able to construct and apply sets in code. Core operations (Python set ) …
CS_B4.1.6
Hash tables and set mechanics
Hashing functions, collision resolution, load factor, and the language built-ins.
The core principle of any ADT is a high-level description of a data structure and its operations, hiding the mechanics. You must be able to explain the mechanics behind sets and hash tables, and relate them to the language built-ins. Hash table : stores key/value …
