Quick Index
Overview


We'll take a quick look at the importance of detail in algorithms.

Printing a List (Original)


Detailed Steps 1 of 2
Here is the original algorithm we developed for printing a list.
println(list) {
	Let 'i' equal to zero
	Let 'len' equal to length of 'list'
	While 'i' is less than 'len'
		Let 'nextElement' equal to the element in 'list' at index 'i'
		Print 'nextElement'
		Let 'i' equal to 'i' plus 1
}


Printing a List (Revisited)


Detailed Steps 1 of 2
Here is the same algorithm but with just a couple steps. This makes it vague. How are we looping? How long? Over what? Where do we get 'nextElement'?

This is a reminder to carefully write detailed steps.
println(list) {
	Loop
		Print 'nextElement'
Detailed Steps 2 of 2
Here is an example of missing a small step. Just the one missing step causes an infinite loop (i.e., stack overflow).

This is another reminder to carefully write detailed steps.
println(list) {
	Let 'i' equal to zero
	Let 'len' equal to length of 'list'
	While 'i' is less than 'len'
		Let 'nextElement' equal to the element in 'list' at index 'i'
		Print 'nextElement'
		Let 'i' equal to 'i' plus 1