REVISION AND PRACTICE

Source guide and dataset conventions

2 min read
On this page 4 headings

Week 2 uses the ten supplied lecture transcripts and Tutorials 2.1–2.8. The repeated Week 1 slide decks remain references for fields, types, flowchart symbols and valid input assumptions.

Source-to-lesson map

SourceTopic
Lecture 2.1Conditional termination and ordered search.
Lecture 2.2; Tutorial 2.1Running maximum; words and bills.
Lecture 2.3; Tutorial 2.2Longest sentence and grouped month runs.
Lecture 2.4; Tutorial 2.3Group counts and largest city/store frequency.
Lecture 2.5; Tutorial 2.4Revenue and total letters by part of speech.
Lecture 2.6; Tutorial 2.5Normalized word and customer frequencies.
Lecture 2.7; Tutorial 2.6Retaining maximum identity and ties; frequency-based filtering.
Lecture 2.8Maximum flowchart and owner-list extension.
Lecture 2.9Pseudocode, assignment, field selection and while.
Lecture 2.10; Tutorials 2.7 and 2.8Safe initialization, if–else and nested-condition equivalence.

Dataset-specific answers

Scores.pdf contains 30 unique records and Words.pdf contains 65 word occurrences. The supplied tables define IDs and spelling for reproducible examples. Bill summaries use printed BillNo 1–30 and printed totals. Other archive datasets such as trains and library examples are outside the scope of these Week 2 lessons.

Differences from spoken demonstrations

Under lowercase keys with surrounding punctuation stripped, Words.pdf has 47 distinct words and sentence lengths 4,7,8,21,25. Spoken demonstrations give some different counts or token splits. Chemistry maximum in the supplied Scores table is 97, even though an initialization tutorial uses 93 in its illustration. These notes retain the ideas while using the actual supplied table for worked answers.

Algorithmic details made explicit

A maximum value seeded at zero needs a nonnegative-input assumption; returning an owner also needs a first-candidate or equality policy. Empty input has no maximum. A new higher value resets prior tied owners. A last group must be finalized even without a following key change.

A running maximum of incremented frequencies is valid because they never decrease. Group-total shortcuts use nonnegative additions; negative adjustments can invalidate a former leader. Minimum final frequency does not follow the same simple running-maximum logic, because the smallest counter can later increase.

Found flags answer existence, not the count of all matches. Ordered word searches stay within the target sentence. Both passes of frequency-based filtering use the same normalization. Pseudocode is descriptive text, with = for assignment and == for comparison in this week’s notation.

YOUR STUDY PROGRESS

Finished this section? Save your progress.

Back to top ↑