Standard Algorithms Flashcards

1
Q

Finding minimum

A

SET Minimum to testscore [0]
FOR counter FROM 1 TO length [testscore]
IF testscore [counter]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Once implemented, standard algorithms may be saved as

A

Modules

A collection of prewritten modules is called a library

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly