Algorithms (7.1, 7.2, 7.8) Flashcards
a sequence of steps that solves a problem, or generates a calculation.
algorithm
The number of calculations required to solve a problem.
algorithm time efficiency
A _____ specifies: an input, a question about that input that can be answered using a computer, and the desired output.
computational problem
_____ are a set of problems for which no known efficient algorithm exists.
NP-complete problems
Is algorithm development started before, during, or after writing a program?
Before
A name created by a programmer for an item like a variable or function. Must be a sequence of letters, underscores, and digits or start with a letter or underscore. They are case sensitive.
Identifier
Special value indicating the end of a list, such as a list of positive integers ending with 0.
Sentinel Value
Can be a number, a variable name (numApples), or a simple calculation like (numApples + 1).
Expression
A program performs computations on that data, such as adding two values like x + y.
process
A list of statements executed by invoking the function’s name, with such invoking know as a function call.
function
Any function input values that appear within ( ), and are separated by commas if more than one.
arguments
A value provided to a function’s parameter during a function call.
argument
A named list of statements
function
Dividing a nonzero floating-point number by zero.
+ or - infinity
A function may return one value and does so by assigning a ___ with the return value.
return variable