Back to Topic 8.1 — Fundamentals of ADTs
8.1.5Computer Science HL5 flashcards

Sets

Practice Flashcards

Flip to reveal answers
Card 1 of 58.1.5
8.1.5
Question

What two guarantees does a set make?

Click to reveal answer

Track your progress — Sign up free to save your progress and get smart review reminders based on spaced repetition.

All 5 Flashcards — Sets

Sign up free to track progress and get spaced-repetition review schedules.

Card 1definition

Question

What two guarantees does a set make?

Answer

**No duplicates** and **no order** — both enforced by the structure rather than by the programmer.

Card 2definition

Question

Union, intersection, difference — what are they?

Answer

**Union** everything in either · **intersection** only what is in both · **difference** in the first and not the second.

Card 3concept

Question

Is a − b the same as b − a?

Answer

**No.** With a = {1,2,3} and b = {3,4}: a − b = {1,2} but b − a = {4}. Difference is the one operation whose order matters.

Card 4concept

Question

Why is set membership O(1) on average?

Answer

The value itself computes where it would be stored, so nothing is searched for. A list must compare against every element — O(n).

Card 5example

Question

When is a set the wrong choice?

Answer

When the program needs **position or order** — a set has neither, and no index to ask with.

Track your progress with spaced repetition

Sign up free — Aimnova tells you exactly which cards to review and when, so you remember everything before your IB exam.

Start Free
IB Computer Science Sets Flashcards | 8.1.5 | Aimnova