Curriculum

Curriculum

Choose Between a List and a Key-Value Map

Scenario

Assign each data problem to Ordered List (Input group) or Key-Value Map (Output group).

Card3
Ordered list0
Key-value map0

Try it yourself

Classify each campus data task into Ordered List or Key-Value Map.

Reveal the explanation
  1. Workshop waitlist where the first student who joined is promoted first

    Ordered List — arrival order determines who is promoted next.

  2. Look up free seats immediately using a unique room code like "Room-204"

    Key-Value Map — direct lookup by unique key avoids scanning every room.

  3. Question-by-question quiz answer key ["A", "C", "B", "D"]

    Ordered List — each answer is matched by its exact question position.

Lists excel at ordered queues, answer sequences, and step logs. Maps excel at direct lookup by unique identifiers like room IDs or student IDs.

Review first

Your turn

Pick list or map for (a) storing each student’s remaining print quota by studentId, and (b) keeping the daily print job queue.

Common mistake Using a map for a queue where arrival order is the core rule.

Check your work

(a) Map keyed by studentId; (b) Ordered list for the print queue.

Quick check

Which structure fits looking up a library book’s availability directly by its unique barcode?
Show the answer and reasoning

Correct answer A key-value map keyed by barcode

Unique barcodes map cleanly to direct key-value lookups.