Chapter 2 Flashcards
Invitation to Computer Science 8th ED
What does algorithmic problem solving focus on
Algorithmic problem solving focuses on algorithms suitable for computers such as searching lists and matching patterns
What is pseudocode
A tool for designing algorithms but does not run on a computing device
Describe natural language
Expressive and easy to use
Verbose, unstructured, and ambiguous
Describe programming language
Structured and designed for computers
Grammatically fussy and cryptic
Describe pseudocode in relation to natural and programming language
lies somewhere between the two and is used to design algorithms prior to coding them
What is the function of sequential operations
To perform a single task
What are the three basic sequential operations
Computation
Input
Output
What is computation (operation)
A single numeric calculation
What is input (operation)
Gets data values from outside the algorithm
What is output(operation)
sends data values to the outside world
What is a sequential algorithm
An algorithm made up only of sequential operations
What is a variable
a named storage location to hold a data value
What is a control operation
changes the normal flow of control
What is a conditional statement
asks a question and selects among alternative options
What is the first step of a conditional statement
- evaluate the true/false condition
What is the second step of a conditional statement
- If the condition is true then do the first set of operations and skip the second set
What is the third step of a conditional statement
- If the condition is false, skip the first set of operations and do the second set
What is an iteration
an operation that causes looping, repeating a block of instructions
What is a continuation condition
A test to see if while loop should continue
What is a loop body
instructions to be performed repeatedly
What is true about a do/while and an alternate iterative operation
continuation condition appears at the end and loop body is always performed at least once
What are the primitive operations
sequential, conditional and iterative are all that is needed
What is a library
a collection of prewritten, useful algorithms
What is pattern matching algorithms used for
to locate every occurrence of the given pattern within the text.
What is the output of the pattern matching algorithm
the locations in the text where each match occurred
What are the two parts of an algorithm
- *Sliding the pattern along the text, aligning it with each position in turn
- *Given a particular alignment, determine if there is a match at that location
How do you solve an algorithm
Solve each part separately and/or use abstraction and top-down design
What is abstraction in relation to an algorithm
when you focus on high level and not the details
what is top-down design in relation to an algorithm
start with the big picture and gradually elaborate parts