icon picker
standard algorithms

Solve problems by applying these well known techniques

ℹ️ standard algorithms

The standard algorithms are a set of well-known steps for getting results from a list of values.
count the occurrences of a value (how many times does a value appear in a list).
find maximin, find minimum (what is the largest, or smallest, value in a list.
search for to locate or check for the presence of a target value in a list.

data array

475644506139
how many values are above 50 (count)
what is the largest value (find max)
what is the lowest value (find min)
does the value 50 appear (linear search)

count algorithm

1 set count to 02 loop for each value3 if next value matches target condition4 add 1 to count5 end if6 end loop7 display count
count values above 50 result: 2

find max algorithm

1 set max to -12 loop for each value3 if next value is larger than max4 set max to next value5 end if6 end loop7 display max
result : 61

find min algorithm

1 set min to 9992 loop for each value3 if next value is smaller than min4 set min to next value5 end if6 end loop7 display min
result : 39

linear search algorithm

1 set found to false2 loop for each value3 if value matches search target4 set found to true. (display position)5 end if6 end loop7 display found
search for 50 result: true
re-using a standard algorithm design

ℹ️ algorithms remix

count, multiple counts/ conditions
max and position
min and position
search and stop, report position
search without flag

data array

475044506139
how many values are above 50, how many are below 45 (count)
what is the largest value and what position is it in the list (find max)
what is the lowest value and what position is it in the list (find min)
does the value 50 appear and at what position (linear search)

count algorithm

1 set countA to 0 2 set countB to 0 3 loop for each value 4 if next value matches first target condition 5 add 1 to countA 6 end if 7 if next value matches second target condition 8 add 1 to countB 9 end if10 end loop11 display countA, countB
count values above 50 and those below 45 result: 2

find max algorithm

remix:
report the location of the max value
1 set max to first value2 set maxPosition to 03 loop for each value starting at the second value4 if next value is larger than max5 set max to next value6 set maxPosition to position of next value7 end if8 display max9 display maxPosition
result : 61 at position 4

find min algorithm

remix:
report the location of the min value
1 set min to first value2 set minPosition to 03 loop for each value starting at the second value4 if next value is smaller than min5 set min to next value6 set minPosition to position of next value7 end if8 display min9 display minPosition
result : 39 at position 5

linear search algorithm

remix:
stop searching as soon a value is located,
report the location
use a while loop
1 set found to -1 2 set position = 0 3 loop while found = 0 and position < length of data array 4 if value at position matches search target 5 set found to position of next value 6 end if 7 add 1 to position 8 end loop 9 if found = 010 display not present11 else12 display value located at found13 end if
search for 50 result: true

ℹ️ algorithm mashup


sequence of algorithms
max then count

integration of algorithms
find max and min on a single traverse

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.