IB Computer Science HL · Year 2 · Lesson 27

Sets as ADTs

Abstract data types separate what operations mean from how they are implemented, helping you choose structures by behaviour and trade-offs.

Paper 250 minutesB4.1.5
Today’s targets

What you need to be able to do

2 / 8
  • Construct + applyAnd apply sets as an ADT
B4.1.5
Paper 2 lensMatch the depth of every response to the command term. Previously learned content can move quickly, but retrieval must still be accurate.
Retrieve

Rapid Recall Deck

3 / 8

Say the answer aloud before flipping. Mark secure knowledge quickly and spend time on the gaps.

  • What two characteristics define a set ADT?: Elements are unique and the set is unordered.
  • What does the union of two sets contain?: Every element that appears in either set, with no duplicates.
  • What does the intersection of two sets contain?: Only elements present in both sets.
  • What does the difference A − B contain?: Elements that are in A but not in B.
  • What do subset and superset describe?: A is a subset of B if every element of A is in B; B is then a superset of A.
B4.1.5 · Learn

Core knowledge and application

4 / 8
B4.1.5Construct + apply

And apply sets as an ADT

Abstract data types separate what operations mean from how they are implemented, helping you choose structures by behaviour and trade-offs.

Exam moveBuild the structure/solution and use it correctly in a new context.
Required detail 1The fundamental characteristics of sets, including their unordered nature and the uniqueness of elements
Required detail 2Operations: union, intersection and difference
Required detail 3Code to check if an element is in a set, to add an element to a set, to remove an element, and to check whether one set is a subset/superset of another set
Assessment boundaryPaper 2

Explain it without notes

Construct + apply: And apply sets as an ADT in the context of a system that needs efficient insertion, search and set membership.

  • The fundamental characteristics of sets, including their unordered nature and the uniqueness of elements
  • Operations: union, intersection and difference
  • Code to check if an element is in a set, to add an element to a set, to remove an element, and to check whether one set is a subset/superset of another set
Trace / construct

Programming checkpoint

5 / 8
a = {1, 2, 3}
b = {3, 4}
print(a | b)   # union
print(a & b)   # intersection
print(a - b)   # difference
Before you run itTrace the code by hand. Identify state changes, branch/loop behaviour, and the final result.

Modify it

Change one condition, input or operation so the program solves a slightly different problem. Predict the effect before editing.

Apply

Transfer to a new scenario

6 / 8
ScenarioA system that needs efficient insertion, search and set membership needs a design or technical decision related to today’s topic. Explain what matters and why.
  • The fundamental characteristics of sets, including their unordered nature and the uniqueness of elements
  • Operations: union, intersection and difference
Exam lens

Paper 2 practice

7 / 8
Build the response before checking notesUse precise terminology and match the required depth.
  1. Construct + apply: And apply sets as an ADT in the context of a system that needs efficient insertion, search and set membership.
Self-checkAnswer the exact command term. For explain, include mechanism/reason; for compare, pair criteria; for discuss/evaluate/justify, build supported reasoning and a conclusion.
Homework

Finish the learning cycle

8 / 8

IA — main task

Continue Criterion D development. Keep code readable, record meaningful implementation decisions, and maintain testing/evidence notes as you work.

Syllabus — short

Complete one targeted Paper 2/Paper 1 retrieval task from today’s lesson.