跳到主要内容

title: "考纲要点"

考纲要点

19.1.10 Dictionary ADT

What you must know:

#要点掌握程度
1Define dictionary ADTMust be able to describe in words
2Key-value pair conceptMust be able to explain with examples
3Operations: add, get, remove, isEmpty, sizeMust be able to write pseudocode
4Implementation using parallel arraysMust be able to write and trace
5Implementation using linked listMust be able to write and trace
6Time complexity of each operationMust be able to state and justify

Syllabus terminology checklist:

TermMeaning
DictionaryADT storing (key, value) pairs, key must be unique
KeyUnique identifier used for lookup
ValueData associated with a key
MappingRelationship from key to value
Parallel arraysTwo arrays of same length sharing same index for key and value
Collision(Not in 9618 syllabus, but be aware it exists for hash table implementations)

Quick self-test questions:

  1. What is the difference between a dictionary and a 1D array?
  2. Write pseudocode for get(key) using parallel arrays.
  3. Write pseudocode for remove(key) using a linked list.
  4. State the worst-case time complexity of get(key) on an unsorted array implementation.
  5. Can two different keys map to the same value? — (Yes, only keys must be unique, not values)