Task 1 Task 2 Task 3
Random Name

Task 1

The following pseudocode describes a function called getBigNumber. It declares an array of 1000 elements, populates the array with numbers between 0 and 10000, and returns the biggest number in the array.

FUNCTION getBigNumber RETURNS INTEGER

DECLARE nums : ARRAY[0:999] OF INTEGER

FOR i ← 0 TO 999

nums[i] ← RANDOM(0,10000)

DECLARE biggest : INTEGER

biggest ← 0

FOR i ← 0 TO 999

IF nums[i] > biggest THEN

biggest = nums[i]

RETURN biggest

END FUNCTION

Draw the identifier table for this algorithm.

Random Name

Task 2

Consider the linear search algorithm on the unit page. It is inefficient because it uses a FOR loop. If the algorithm finds the value being searched for, it should update found to True and stop searching.

Redesign the algorithm such that it will stop searching the array if it finds the value.

Hint: to help you think about this problem, it may be useful to develop program code first.

Submit your algorithm and an identifier table for this problem.