Chapter 2 Flashcards
What is involved in the process of program development?
Problem description
- Input
- Result (output)
Algorithm
- Pseudocode is fine
Program
- Java, C, Python
Machine instructions (executable)
How is pseudocode created?
It’s created from using components of natural language to express algorithms
- Pseudocode = “Not real” Code
What are some issues with using natural language to represent algorithms?
- Natural language can be extremely verbose
- Lack of structure makes it difficult to locate specific sections of the algorithm
- Natural language is too “rich” in interpretation and meaning
- Not sufficiently precise to represnt algorithms
Why is using pseudocode beneficial?
- Used to design and represent algorithms
- A compromise between the two extremes of natural and formal languages
- Will not be unique
Define:
Sequential Algorithm
Sometimes called a straight-line algorithm; the order is followed in a linear fashion.
Define:
Control Operations
- Conditional and iterative
- Allow us to alter the normal sequential flow of control in an algorithm
Define:
Conditional Statements
- The “question-asking” operations of an algorithm
- If/then/else
Define:
Loop
- The repetition of a block of instructions
- While or For loop statement
Define:
Continuation Condition
Determines if statement is true or false
- if/elif statements
Give an example of a loop.
Define:
Pretest Loop
Continuation condition is tested at the beginning of each pass through the loop
Define:
Posttest Loop
Continuation condition is tested at the end of the loop body, not the beginning.
Define:
Primitives
Instructions that computing agent understands and is capable of executing without further explanation.
Define:
Pattern Matching
- Process of searching for a special pattern of symbols within a larger collection of information.
- Is assisting microbiologist and geneticists studying and mapping the human genome.
Give examples of higher-level constructs.
- Sort the entire list into ascending order.
- Attempt to match the entire pattern against the text.
- Find a root of the equation.