JavaScript required
We’re sorry, but Coda doesn’t work properly without JavaScript enabled.
Skip to content
Gallery
csHjavaA-2019
about this document
revision
traverse and process
standard algorithms
Parallel Arrays
read text files
write text files
CSV files
Letter frequency
development workflow
indices
More
Share
Explore
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
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
count values above 50 result: 2
find max algorithm
result : 61
find min algorithm
result : 39
linear search algorithm
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
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
count values above 50 and those below 45 result: 2
find max algorithm
remix:
report the location of the max value
result : 61 at position 4
find min algorithm
remix:
report the location of the min value
result : 39 at position 5
linear search algorithm
remix:
stop searching as soon a value is located,
report the location
use a while loop
search for 50 result: true
ℹ️ algorithm mashup
sequence of algorithms
max then count
integration of algorithms
find max and min on a single traverse
ℹ️ standard algorithms
data array
count algorithm
find max algorithm
find min algorithm
linear search algorithm
ℹ️ algorithms remix
data array
count algorithm
find max algorithm
find min algorithm
linear search algorithm
ℹ️ algorithm mashup
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
Ctrl
P
) instead.