← VCE Pseudocode

Selection Sort algorithm in pseudocode

An algorithm that repeatedly finds the smallest remaining element and swaps it into its correct position.

Understanding Selection Sort algorithm in pseudocode in VCE Pseudocode

What it does: This line updates min to the newly found smaller index. Each pass scans the unsorted part for the smallest element. Selection sort works on unsorted arrays and sorts them in place. min is updated to track the index of the smallest value so far. Assignment uses ←, not =, in pseudocode. Swapping places the smallest found element at the front. Array elements use square brackets, not round brackets. This condition looks for a new smallest element.

Common mistakes: Selection sort starts at index 1, not 0, by convention. Assignment uses ←, not =, to update min.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 11–28) and word search (Modules 1–28).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Does selection sort find the smallest remaining element each pass?
YesNo
Matches
IF arr(j) < arr[min] THEN
↓
Wrong - array elements use square brackets, not round brackets
Applying
Meanings
Term
Selection Sort
Meaning
An algorithm that repeatedly finds the smallest remaining element and swaps it into its correct position.
Practice
BEGIN
Testing
Gaps
i FROM 1 TO 4
Check Answer
Spots
1FOR i FROM 0 TO 4
2min ← i

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Reef Shark' badge — Reef Ruler, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Does selection sort find the smallest remaining element each pass?
A. Yes ✓
B. No
Each pass scans the unsorted part for the smallest element.
2. Does selection sort require the array to already be sorted?
A. Yes
B. No ✓
Selection sort works on unsorted arrays and sorts them in place.
3. Is arr[j] < arr[min] used to compare elements for the minimum?
A. No
B. Yes ✓
This comparison checks if a smaller element has been found.
4. Does min ← j record the position of a smaller element found?
A. Yes ✓
B. No
min is updated to track the index of the smallest value so far.
5. Is min = j valid assignment syntax in pseudocode?
A. No ✓
B. Yes
Assignment uses ←, not =, in pseudocode.

Match the Pairs

min ← 1 → Sets the starting minimum index to the first position
IF arr[j] < arr[min] THEN → Checks whether the current element is smaller than the tracked minimum
Records the position of the smaller element found → min ← j
Swaps the minimum element into its sorted position → arr[1] ← arr[min]
IF arr(j) < arr[min] THEN → Wrong - array elements use square brackets, not round brackets
min = j → Wrong - assignment uses ←, not =, in pseudocode

Key Term

Selection Sort
An algorithm that repeatedly finds the smallest remaining element and swaps it into its correct position.

Fill in the Blanks

1. FOR i FROM 1 TO 4
Hint: Type the loop keyword used to iterate through the array.
2. IF arr[j] < arr[min] THEN
Hint: Type the keyword that starts a selection statement.
3. IF arr[j] < arr[min] THEN
Hint: Type the comparison operator meaning less than.
4. min ← j
Hint: Type the arrow used to assign a value.
5. min ← 1
Hint: Type the variable name used to track the current minimum index.

Spot the Error

Question 1
A FOR i FROM 0 TO 4
B min ← i
C FOR j FROM i+1 TO 5
Line A — Selection sort starts at index 1, not 0, by convention.
Question 2
A FOR i FROM 1 TO 4
B min = i
C FOR j FROM i+1 TO 5
Line B — Assignment uses ←, not =, in pseudocode.
Question 3
A min ← i
B FOR j FROM i+1 TO 5
C IF arr(j) < arr[min] THEN
Line C — Array elements use square brackets, not round brackets.
Question 4
A min ← i
B FOR j FROM i+1 TO 5
C IF arr[j] < arr[min] THEN
D min = j
Line D — Assignment uses ←, not =, to update min.
Question 5
A FOR i FROM 1 TO 4
B min ← i
C FOR j FROM i+1 TO 5
D IF arr[j] < arr[min] THEN
E min == j
Line E — Assignment uses ← only, not ==, in pseudocode.

Student with a class code? Join your class →