Engineering Lab

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.

JavaLinear searchBinary search tree

UCT / COURSE CONTEXT / 2022

CSC2001F · Computer Science 2001

Data storage, data structures and database foundations. Individual implementation is described separately below.

Science handbook · 2022
BetaAlphaGamma
ARRAY COMPARISONS3
TREE COMPARISONS2
VALUE30

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.
STEP 1 / 3

Parse records

Convert CSV fields into keys and values without claiming ownership of the external data.

Source-derived walkthrough

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.

NEXT IN THE ARCHIVEQuestions across relational tables