Big O in plain language flashcards

Understanding Big O notation for algorithms made simple with flashcards.

Happy77·15 schede·12 domande
high schoolcomputer_sciencealgorithms
0
Lo so
1 / 15
0
Sto imparando
Fronte

What is Big O notation?

Tocca per girare
Retro

A mathematical representation that describes the efficiency of an algorithm in terms of time or space.

Tocca per girare
Lo so
Sto imparando

Quiz(12 domande)

Domanda 1 di 12

1. What does O(n^2) signify?

Termini in questo set(15)

What is Big O notation?

A mathematical representation that describes the efficiency of an algorithm in terms of time or space.

O(1)

Constant time complexity; execution time remains the same regardless of input size.

O(n)

Linear time complexity; execution time increases linearly with input size.

O(n^2)

Quadratic time complexity; performance is proportional to the square of the input size.

True or false: O(n log n) is better than O(n^2).

True, because O(n log n) grows slower than O(n^2) with increasing n.

Difference between O(n) and O(n^2)

O(n) grows linearly, while O(n^2) grows quadratically, making O(n^2) slower.

O(log n)

Logarithmic time complexity; execution time grows logarithmically with input size.

What does upper bound mean?

The worst-case scenario performance of an algorithm, described using Big O.

Fill the blank: O(2^n) is called _____ time complexity.

Exponential time complexity.

True or false: O(n) and O(2n) are the same.

False, because O(2n) is still linear but usually considered O(n).

Which is NOT a valid Big O notation?

O(n!), as it's factorial time complexity and grows very fast.

What is space complexity?

A measure of the amount of working storage an algorithm needs.

When is Big O used?

To analyze and compare the efficiency of algorithms.

What is O(n^3)?

Cubic time complexity; execution time increases with the cube of input size.

Fill the blank: The best complexity you can achieve is _____

O(1), which is constant time.

Domande in questo set(12)

1. What does O(n^2) signify?

A.Quadratic complexity
B.Linear complexity
C.Constant complexity
D.Logarithmic complexity

2. Which of the following is the fastest growth rate?

A.O(1)
B.O(n)
C.O(log n)
D.O(n^2)

3. When discussing Big O, what does 'n' typically represent?

A.Number of operations
B.Size of input
C.Execution time
D.Memory usage

4. Which time complexity is worse for large inputs?

A.O(log n)
B.O(n)
C.O(n^2)
D.O(1)

5. What is the average time complexity of quicksort?

A.O(n)
B.O(n log n)
C.O(n^2)
D.O(log n)

6. O(n log n) is commonly associated with which algorithm?

A.Binary Search
B.Merge Sort
C.Bubble Sort
D.Insertion Sort

7. What is a key characteristic of O(2^n)?

A.Linear growth
B.Quadratic growth
C.Exponential growth
D.Constant growth

8. Which complexity indicates a linear relationship?

A.O(1)
B.O(n)
C.O(n^2)
D.O(log n)

9. Which algorithm typically runs in O(n^2) time?

A.Selection Sort
B.Merge Sort
C.Binary Search
D.BFS

10. What does a lower complexity indicate?

A.Slower algorithm
B.Faster algorithm
C.Same speed
D.More memory used

11. If an algorithm is O(n^2), how does it perform as n doubles?

A.Performance halves
B.Performance stays the same
C.Performance quadruples
D.Performance doubles

12. Which is NOT a common Big O notation?

A.O(1)
B.O(n^3)
C.O(n^4)
D.O(n!)

Set correlati

Crea il tuo set di studio

Carica un PDF, incolla le tue note o descrivi un argomento – l'IA genera schede, quiz e altro in pochi secondi.