Skip to content
soln standardAlgorithm
Share
Explore

Algorithm Exercises

solutions to formative exercises for standard algorithms
data structure
competitor: name, category, score, penalty : 200 competitors
Senga Jones,Senior,67,-2
Agnes Adam,Junior,88,0
Raquel Heeks,Adult,92,0
Meriel Harverson,Senior,47,-1

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 Senga Jones,Senior,67,-2 would be saved as S-Sen-nes,65

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.