VCE Vault

VCE Applied Computing: Data Analytics (Year 12) · Software Development crossover (not Data Analytics key knowledge) · 16m read

Software Development — Algorithms, Data Structures and Pseudocode

Crossover note: this is Software Development content, a separate Units 3–4 study with its own subject on VCE Vault. Data Analytics students can use it for problem-solving practice. Software Development Units 3–4 expects you to design and trace algorithms on paper. Pseudocode, data structures and classic searches and sorts appear every year — and tracing someone else’s code is one of the most reliable exam skills.

Learning objective: Design algorithms in pseudocode using appropriate data structures, including searching and sorting.

By the end of this lesson you can:

  • I can write and trace pseudocode with selection and iteration.
  • I can choose suitable data structures and data types.
  • I can compare linear and binary search and common sorts.

Algorithms are recipes; data structures are the pantry. Good recipes need well-organised ingredients — arrays, records and dictionaries store data so algorithms can use it.

Designing algorithms

CONTROL STRUCTURES:
• SEQUENCE — steps in order.
• SELECTION — IF … THEN … ELSE, CASE.
• ITERATION — FOR (counted), WHILE (pre-test), REPEAT … UNTIL (post-test).

DATA TYPES:
• Integer, floating point, string, character, Boolean.

DATA STRUCTURES:
• ARRAY (one-dimensional, two-dimensional) — fixed-size, indexed.
• RECORD — related fields of different types.
• Associative array / dictionary — key → value.
• Queue (FIFO) and stack (LIFO).

SEARCHING:
• LINEAR SEARCH — check each item in turn; works on unsorted data; up to n comparisons.
• BINARY SEARCH — halve a SORTED list each step; about log₂ n comparisons.

SORTING:
• Selection sort and quick sort are named in the study design.
• Quick sort is usually much faster on large data; selection sort is simple to trace.

TRACE TABLES:
• Track each variable’s value line by line to test an algorithm by hand.

Quick reference

| Structure | Use |
|---|---|
| Array/list | Ordered items |
| Record | Grouped fields |
| Dictionary | Key–value lookup |
| Stack/queue | LIFO/FIFO |
| Sorting | Selection, quick sort |
| Searching | Linear, binary |

Key ideas at a glance

  • Pseudocode conventions: Clear, language-neutral.
  • Choose efficient algorithms: Big-O.
  • Trace tables: Test logic.
  • Modularise: Functions.

Worked example (Medium)

Trace: total ← 0; FOR i ← 1 TO 4: IF i MOD 2 = 0 THEN total ← total + i; END FOR; OUTPUT total.

  1. i = 1. Odd → total stays 0.
  2. i = 2. Even → total = 2.
  3. i = 3. Odd → total stays 2.
  4. i = 4. Even → total = 6.

Answer: Output: 6

Worked example (Easy)

A sorted list has 1024 items. What is the maximum number of comparisons for a binary search?

  1. Halving. 1024 = 2¹⁰, so about 10 halvings, plus a final check.

Answer: About 10–11 comparisons (vs up to 1024 for linear search).

Common mistakes

  • Using binary search on unsorted data It relies on order to discard half the list. Fix: Sort first, or use linear search.
  • Off-by-one loop bounds Loops run one time too few or too many. Fix: Trace the first and last iteration explicitly.

Quick sort

Quick sort picks a pivot, partitions items smaller and larger, and recursively sorts each side. On average it's O(n log n), making it one of the fastest general-purpose sorts.

Practice questions

  1. Which data structure is LAST-IN, FIRST-OUT?

    1. Queue
    2. Stack
    3. Array
    4. Record

    (1 marks)

Summary

  • Sequence, selection, iteration.
  • Choose data types and structures to fit the data.
  • Binary search needs sorted data; ~log₂ n comparisons.
  • Use trace tables to test algorithms.

More from VCE Applied Computing: Data Analytics (Year 12)