You are on page 1of 2

Chapter 10: Whats the Plan?

Algorithmic Thinking
Algorithm: A Familiar Idea
Algorithm: a precise and systematic method for producing a specified result; precise method used in information processing. o Recognition of a button or click o Placeholder technique o Hex to bits To write a precise algorithm, we need to pay attention to three points: o Capability computer knows what and how to do the operations o Language ensure that the description is unambiguous o Context make few assumptions about the input or execution setting 5 Essential Properties of Algorithms o Input specified: the data to be transformed during the computation to produce the output. Must specify the type of data, the amount of data, and the form that the data will take. o Output specified: the data resulting from the computation, the intended result. Often the description is given in the name of the algorithm o Definiteness: specifying the sequence of operations for transforming the input into the output. Ensures that if the algorithm is performed at different times or by different agents using the same data, the output is the same. o Effectiveness: the operations are doable. o Finiteness: algorithm must eventually stop, either with the right output or with a statement that no solution is possible. Language o Natural Language Used when the agent is a person

Ambiguity exists

o Programming Language Agent is the computer Formal Language: programming languages that are designed to express algorithms. Rarely ambiguous

Context: the assumptions of the program are not fulfilled. o can have everything else, but be executed in the wrong context, and it will not work. Program an algorithm that has been customized to solve a specific task under a specific set of circumstances in a specific language.

Analyzing Alphabetize CDs Algorithm


Loops: instruction sequences that repeat, they are more obvious when the instructions are given in a form other than English. o Cause parts of the computation to be performed, as many times as there are data items. o Test: determines if the instructions should be repeated one more time. Tests cause the loop to complete and ensure the finiteness property. If there are no changes between the two consecutive tests, the outcome is the same and the loop never stops. Exchange sort: algorithm compares pairs of items chosen in a particular way, exchanges them if they are out of order, and continues to sweep through the items to locate the next minimal item. o Alpha and Beta Swep

Abstraction in Algorithmic Thinking


The Beta sweep is o Exhaustive o Nonredundant o Progressive o Goal-achieving

You might also like