2 - Numbers and sequence Flashcards
What is an Abstract Data Type (ADT)?
An Abstract Data Type is a high-level specification that defines the collection of allowed values and the operations that can be performed on those values within a data structure, without concerning itself with implementation details.
What are real numbers
Real numbers are numbers that can be represented in decimal form with either finite or infinite numbers after the decimal point.
What are natural numbers?
Natural numbers are non-negative numbers starting from 0 and counting upwards infinitely: 0, 1, 2, 3, and so on.
What is the typical format for assignments in M269 when writing algorithms in English?
Assignments in M269 English-style algorithms are typically written as:
“let variable be expression.”
How can you display the value of an expression in an English-style algorithm?
To display the value of an expression in an English-style algorithm, you can use the instruction: “print expression.”
What defines an algorithm with constant complexity?
Algorithms with constant complexity are those where the runtime does not grow with increasing input values.
How is “complexity” defined in the context of algorithms?
Complexity, in the context of algorithms, measures the algorithm’s growth rate of runtime for ever-increasing inputs when executed in the same environment (e.g., operating system and hardware).
What does complexity focus on in terms of algorithm performance?
Complexity is not about how fast an algorithm runs but is a measure of how it runs for different input sizes.
Why are arithmetic instructions considered to have constant complexity in the context of modern processors?
Modern processors can perform arithmetic operations on 64-bit numbers in a single hardware instruction, which is why arithmetic instructions are considered to have constant complexity. This means that for any number, regardless of its size, the operation will always take the same amount of time.
When dealing with algorithm analysis, what can be assumed about assignments and return statements in terms of complexity?
It is assumed that assignments and return statements have a constant complexity.
How does an algorithm with a fixed number of operations, each with constant complexity, behave in terms of complexity?
An algorithm with a fixed number of operations, each with constant complexity, will itself have a constant complexity.
How is Big-Theta notation used in algorithm analysis?
Big-Theta notation is used to concisely and precisely state the complexity of an algorithm.
What does Θ(1) represent in Big-Theta notation when describing the complexity of an algorithm?
In Big-Theta notation, Θ(1) represents an algorithm with constant complexity, which means it has a runtime that doesn’t depend on the size of the input.
How can we express an algorithm with constant complexity in terms of Big-Theta notation?
An algorithm with constant complexity is expressed using Big-Theta notation as:
It has complexity Θ(1).
It takes Θ(1) time.
Its run-time is Θ(1).
What characterizes an algorithm with linear complexity?
An algorithm with linear complexity grows in proportion to the size of its inputs, meaning that its runtime increases as the input size increases.