AggregateScores(all_scores[500][8])
num_studs = 500
num_subjs = 8
Let aggregates[num_studs] is another array
for i = 1 to num_studs
smallest = all_scores[i][1]
second = all_scores[i][2]
if smallest > second
swap(smallest, second)
total = smallest + second
for j = 3 to num_subjs
score = all_scores[i][j]
total += score
if score < second
if score < smallest:
second = smallest
smallest = score
else:
second = score
aggregates[i] = total - smallest - second
return aggregates
Comments
Leave a comment