Standard Algorithms Flashcards
1
Q
Finding minimum
A
SET Minimum to testscore [0]
FOR counter FROM 1 TO length [testscore]
IF testscore [counter]
2
Q
Input Validation
A
Ask the user to input a value REPEAT RECEIVE value FROM (INTEGER) KEYBOARD IF value does not meet condition THEN SEND message asking user to try again END IF UNTIL criteria is met
3
Q
Once implemented, standard algorithms may be saved as
A
Modules
A collection of prewritten modules is called a library
4
Q
Find Maximum
A
SET maximum TO testscore[0] FOR counter FROM 1 TO length [testscore] IF testscore[counter] > Maximum THEN SET Maximum TO testscore[counter] END IF END FOR SEND message & maximum TO display
5
Q
Linear Search
A
SEND "Here are the values found" FOR counter FROM 0 TO length [arrayname] IF arrayname [counter] meets criteria THEN SEND arrayname[counter] to display End IF End FOR
6
Q
Count Occurences
A
SET totalfound to 0
FOR counter FROM 0 TO length [arrayname]
IF arrayname [counter] meets criteria THEN
SET totalfound TO totalfound + 1
END IF
END FOR
SEND “The number found was” & totalfound TO DISPLAY