Free Online Flashcard Deck

09. Evaluating Algorithm Efficiency Free Online FlashCards

Study 09. Evaluating Algorithm Efficiency with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.

12 cards
01
Front

Why analyze algorithms instead of timing one program run?

Back

Algorithm analysis estimates how resource requirements change as input size grows, making comparisons less dependent on hardware, language, compiler, and other system conditions.

02
Front

What are the two principal resources in algorithm analysis?

Back

Time complexity measures computational work; space complexity measures memory required while the algorithm runs.

03
Front

What does n represent in algorithm analysis?

Back

Input size is problem-dependent: for an array it is usually the number of elements, while for a binary number it is the number of bits.

04
Front

What is a cost model?

Back

A cost model specifies which operations count as basic operations, such as assignments, comparisons, arithmetic operations, array accesses, and Boolean tests.

05
Front

How are sequential algorithm sections analyzed?

Back

Costs of consecutive sections are added. For example, O(n) + O(n) = O(2n), which simplifies to O(n) because constant factors are ignored.

06
Front

What is the complexity of two nested loops, each running n times?

Back

The inner statement executes n × n = n² times, so the nested loops have O(n²) running time.

07
Front

Why does repeatedly halving a problem take O(log n) time?

Back

Repeatedly halving the remaining work takes O(log n) time because after k iterations the remaining amount is approximately n/2^k.

08
Front

What are best-case, worst-case, and average-case analysis?

Back

Best case is the least work for inputs of size n; worst case is the greatest; average case is the expected work under an assumed input distribution.

09
Front

What does T(n) ∈ O(f(n)) mean?

Back

Big-O is an asymptotic upper bound: T(n) ≤ c f(n) for suitable positive constants c and n₀ and all n ≥ n₀.

10
Front

How is the dominant term used to classify growth?

Back

In 4n² + 7n + 12, the n² term eventually dominates, so the function has quadratic growth: Θ(n²).

11
Front

What does Big-Ω notation describe?

Back

Big-Ω describes an asymptotic lower bound: the algorithm requires at least a proportional amount of work represented by f(n) for sufficiently large n.

12
Front

What does T(n) ∈ Θ(f(n)) mean?

Back

Big-Θ is a tight asymptotic bound: T(n) is both O(f(n)) and Ω(f(n)).