UCT CSC2001 / 2022
Two ways to find a record
Compare array scanning and tree-based record lookup to make search cost, insertion order and missing-key behaviour visible.
UCT / COURSE CONTEXT / 2022
CSC2001F · Computer Science 2001
Data storage, data structures and database foundations. Individual implementation is described separately below.
Synthetic demonstration data: three invented country keys and counts, fixed date 2022-01-01. The new interface mirrors linear scanning and the supplied BST's country+date comparison. It does not expose the original vaccinations CSV or claim a general tree speedup; sorted insertions can degenerate an unbalanced tree.
ENGINEERING PERSPECTIVE
Inside the work
Compare data-structure choices for repeated key lookup. The same country/date record can be found by scanning or by following ordered tree branches, making input order and tree shape part of the engineering decision.
- Java / CSV parsing
- Create records and compare composite country/date keys.
- Array / supplied BST
- A bounded scan is contrasted with an attributed binary-search-tree framework.
Parse records
Convert CSV fields into keys and values without claiming ownership of the external data.
- Linear search
- The intact array implementation checks inserted records only; worst-case work grows with record count.
- Tree height
- BST lookup follows comparisons. No balancing is implemented, so insertion order can create a linear-height tree.
- Missing keys
- A lookup must distinguish absence from an invalid index or uninitialized slot.
What the demonstration establishes
The browser comparison uses invented records and displays comparison steps. Private synthetic checks cover found/missing keys; no original public-health dataset is published.
Evidence behind this page
Intact VaccineArray source and separately attributed tree framework.
How it works
Parse CSV fields into Vaccine records. compareTo orders concatenated country/date keys; the array scans inserted entries and the BST follows left/right comparisons. The interface accepts a date and multiple country queries.
Results & recovery
- Both Java lookup structures were recovered in source. New synthetic checks validate found and missing keys in a private cleaned copy.
- The browser illustration uses three invented keys/counts and shows comparisons, not original public-health data.
Technical limitations
The original application hardcodes a relative CSV location and bounds the array. One earlier copy scans unfilled slots; the intact later copy uses records and returns null for absent keys. Tree shape depends on insertion order.
What I would improve now
Provide an explicit data-path CLI, input validation and larger deterministic fixtures. Keep scaffold attribution and raw-data provenance separate from source authorship.