![]() Capt. Horatio T.P. Webb | Last Updated 8AM 2/25/2015 |
Algorithm:
"Computing is normally done by writing certain symbols on paper. We may suppose this paper is divided into squares like a child's arithmetic book....
I assume then that the computation is carried out on one-dimensional paper, i.e., on a tape divided into squares. I shall also suppose that the number of symbols which may be printed is finite....
The behaviour of the computer at any moment is determined by the symbols which he is observing, and his 'state of mind' at that moment. We may suppose that there is a bound B to the number of symbols or squares which the computer can observe at one moment. If he wishes to observe more, he must use successive observations. We will also suppose that the number of states of mind which need be taken into account is finite...
Let us imagine that the operations performed by the computer to be split up into 'simple operations' which are so elementary that it is not easy to imagine them further divided."
Turing's reduction yields the following:
"The simple operations must therefore include:
It may be that some of these change necessarily invoke a change of state of mind. The most general single operation must therefore be taken to be one of the following:
We may now construct a machine to do the work of this computer."
The Structure Theorem (1966)
by Corrado Bohm and Giuseppe Jacopini. All algorithms are constructed using only three constructs:
Nassi Schneiderman Diagrams (1972)
by Isaac Nassi and Ben Shneiderman (graduate students in computer science at SUNY - Stoney Brook)
or this by Schneiderman
Examples of everyday Algorithms (Lists-Of-Things-To-Do -- LOTTD)
Sample was knit with approximately 140gm of crepe spun baby wool (yardage
unknown) on 3.25mm needles and would fit a small new-born.
Gauge of sample: 13sts and 28 rows to 5cm over garter st.
Use Number 3 Needles/2 ply yarn
Original pattern was knit on size 3 needles, of 3 play baby yarn and
looks like it may fit new-born to three months. To make it bigger, just
use appropriate yarn you want (such as knitting
worsted) and then use the suggested needles and gauge for THAT
yarn. Knitting worsted on size 7 comes out bigger - maybe 6 to 9 months
size
Pattern:
Cast on 60 stitches.
Knit two rows on these 60 stitches.
Row 1 - Knit 50 stitches, wrap and turn
Row 2 - Pull yarn to back, slip one stitch (as if to purl) from left needle onto right needle, knit to other end (count this as the bottom).
Row 3 - Knit complete 60 stitches to top or neck edge.
Row 4 - Knit from neck edge to bottom edge; then go back to Row 1.
Continue these short rows until you have 30-35 ridges depending on size you want).
Then knit 35 stitches and place on a stitch holder. Knit 15 stitches, keeping last 10 stitches same as before for yoke.
Knit down 25 stitches (including stitches for yoke), turn and cast on 30 stitches for sleeve.
Work 10 stitches at cuff edge same as yoke (Knit 45, slip one stitch from left needle onto right needle; turn and knit to other end).
When you have 25 ridges on cuff edge, bind off the 30 stitches you put on for sleeve.
Slip the 35 stitches from holder and make back, same as front, always keeping the yoke the same.
When you have 65 ridges on the bottom of the back (don't forget to adjust the number of ridges if you previously adjusted them on the front) , Knit 35 stitches and put on a holder.
Make other sleeve.
Make other front.
Neck edge - pick up with # 1 needle at neck about 92 stitches. K2, P2 for 4 rows. Next row - K4, K2 tog across row to end. Knit one row. Then bind off.
Make 2 small chains (no longer than 12cm) and attach at neck edges to form tie.
Chunking (modularization)
Once an algorithm is complete and is expressed as (a) a list of verbs (instructions) or (b) drawn with a Nassi-Schneiderman diagram (a stack of boxes), the entire algorithm represents a "procedure to perform some action". If we think about the list in its entirety it can be called:
All of these "chunks" or lists of instructions are purposeful -- i.e., they do "something". If we were to devise a "name" for what the actions of performing the chunks accomplishes, the name should ALWAYS be a verb. This indicates that if we do what the list (module, procedure, program, function, method or routine) says, doing it is a verb not a noun. Performing the items on the list represents some action -- a verb.
For example, the name for the biscuit recipe above could be "make_biscuits" or "bake_biscuits" NOT biscuits. Biscuits (the noun) is what we get when we are finished performing the verbs on the list for "making_biscuits" or "baking_biscuits".
You will notice that any button or switch that we interact with in the real world always has a label on it which is a "verb":
It is the same with programming ideas. Each "chunk of code" performs some action (a verb), thus its name should be a verb.
What would you think would happen if you pressed a button that had labels that are nouns:
One might wonder what would happen if you pressed such buttons.
Our purpose here might seem to be just one of clarity. That is true. But more importantly, the "chunking" of instructions is the ONLY way we can deal with complexity.