JavaScript required
We’re sorry, but Coda doesn’t work properly without JavaScript enabled.
Skip to content
Gallery
soln standardAlgorithm
sqa past papers
Algorithm Exercises
More
Share
Explore
Algorithm Exercises
solutions to formative exercises for standard algorithms
data structure
competitor
:
name
,
category
,
score, penalty
: 200 competitors
Data structure tasks
declare as parallel arrays
declare as record-type and an array of records
find max / min
procedure to display name and category of person with biggest penalty (min value): parallel arrays
function to return position of junior member with highest score : parallel array
function to return name of player in a category input by user with best final points (score + penalty) array of records
count occurrence
procedure to count the number of adults, juniors and seniors: parallel arrays
function to return number of members with no penalty points in a category entered by user : array of records
search
procedure to find a penalty value entered by the user, display all properties of the member, parallel arrays
function to return position of a member where name is entered by user : array of records must be an efficient search
save a copy
procedure to save a copy of only the Senior and Adult competitors with an event ID and the final points where
the event ID is the first letter of the category, the first 3 letter and last three letters of name
the final points is the score + penalty
example
Sen
ga Jo
nes
,
S
enior,67,-2 would be saved as S-Sen-nes,65
data structure
find max / min
count occurrence
search
save a copy
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
Ctrl
P
) instead.