1. Home
  2. Explore
  3. Computer Science
  4. MIT Programming Fundamentals Review

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

MIT Programming Fundamentals Review

  • 26Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
The primary focus of measuring efficiency in this lecture is
efficiency, rather than space.

26 questions

  1. 1
    The primary focus of measuring efficiency in this lecture is
    _____
    efficiency, rather than space.
    Hint

    Think about what aspect of performance the lecturer emphasizes as most important.

    Answer

    time

  2. 2
    Two reasons to care about algorithm efficiency are predicting runtime and understanding how design choices influence
    _____
    .
    Hint

    The lecturer mentions two reasons: prediction and the effect of design decisions on performance.

    Answer

    time

  3. 3
    Timing an algorithm as a measure of efficiency is flawed because it depends on implementation, the computer, and does not necessarily predict performance on
    _____
    inputs.
    Hint

    The lecturer mentions that small-scale tests may not reflect behavior when the problem grows.

    Answer

    large

  4. 4
    Counting primitive operations as a measure of efficiency is still dependent on
    _____
    .
    Hint

    The lecturer notes that even operation counts can vary with different implementations.

    Answer

    implementation

  5. 5
    Order of growth abstracts away additive and multiplicative
    _____
    .
    Hint

    We ignore the small factors that don't affect asymptotic behavior.

    Answer

    constants

  6. 6
    Big O notation describes the
    _____
    case upper bound on the growth of runtime as input size increases.
    Hint

    The lecturer states they will focus on the worst-case scenario.

    Answer

    worst

  7. 7
    In Big O notation, we consider the
    _____
    behavior as the input size becomes very large.
    Hint

    This refers to what happens when n grows without bound.

    Answer

    asymptotic

  8. 8
    For a polynomial expression like n2+2n+2n^2 + 2n + 2n2+2n+2, the dominant term and thus the order of growth is
    _____
    .
    Hint

    The term with the highest degree determines the asymptotic behavior.

    Answer

    n2n^2n2

  9. 9
    For the expression 100000n2+n100000n^2 + n100000n2+n, the order of growth is
    _____
    .
    Hint

    Ignore the coefficient and lower-order terms.

    Answer

    n2n^2n2

  10. 10
    For the expression n30+3nn^{30} + 3^nn30+3n, the dominant term for large n is
    _____
    .
    Hint

    Compare a power function to an exponential; exponentials grow faster.

    Answer

    3n3^n3n

  11. 11
    A constant runtime algorithm is denoted as O(
    _____
    ).
    Hint

    Think about the number 1, representing fixed time.

    Answer

    1

  12. 12
    A logarithmic runtime is denoted as O(
    _____
    ).
    Hint

    The runtime grows slowly, like the logarithm of the input size.

    Answer

    lognlog nlogn

  13. 13
    A linear runtime means that if you double the input size, the runtime
    _____
    .
    Hint

    Linear relationship: factor of 2 in input gives factor of 2 in time.

    Answer

    doubles

  14. 14
    A quadratic runtime means that if you double the input size, the runtime
    _____
    .
    Hint

    Quadratic: factor of 2 in input gives factor of 4 in time.

    Answer

    quadruples

  15. 15
    An exponential runtime grows much faster than polynomial; for example, 2n2^n2n is worse than
    _____
    .
    Hint

    Compare exponential to polynomial; exponential dominates eventually.

    Answer

    n2n^2n2

  16. 16
    The law of
    _____
    for orders of growth says that for sequential code, the overall order is the sum, dominated by the largest term.
    Hint

    This law deals with combining independent blocks of code.

    Answer

    addition

  17. 17
    The law of
    _____
    for orders of growth says that for nested loops, the orders multiply.
    Hint

    This law applies when one loop is inside another.

    Answer

    multiplication

  18. 18
    A simple iterative loop that runs n times with constant work per iteration has order of growth O(
    _____
    ).
    Hint

    Think about the number of iterations relative to input size.

    Answer

    n

  19. 19
    Linear search in an unsorted list has worst-case complexity O(
    _____
    ), where n is the length of the list.
    Hint

    You may have to check every element.

    Answer

    n

  20. 20
    Even if the list is sorted, the linear search algorithm still has worst-case complexity O(
    _____
    ).
    Hint

    Though you can stop early if the element is greater, the worst case still requires scanning all elements.

    Answer

    n

  21. 21
    Accessing the i-th element of a Python list takes
    _____
    time due to base+offset addressing.
    Hint

    The lecture explains that indexing is done directly without iteration.

    Answer

    constant

  22. 22
    For heterogeneous lists, Python uses
    _____
    to allow constant-time access to any element.
    Hint

    This technique stores pointers instead of actual values.

    Answer

    indirection

  23. 23
    A nested loop where both loops run n times typically has order of growth O(
    _____
    ).
    Hint

    Multiply the complexities of the two loops.

    Answer

    n2n^2n2

  24. 24
    The subset check algorithm with two nested loops has worst-case complexity O(
    _____
    ) when both lists are of length n.
    Hint

    For each element in the first list, you scan the second list.

    Answer

    n2n^2n2

  25. 25
    The intersection of two lists algorithm using nested loops and membership test has overall complexity O(
    _____
    ) if both lists are of length n.
    Hint

    The two nested loops plus the membership check contribute to quadratic behavior.

    Answer

    n2n^2n2

  26. 26
    The trade-off between time and space efficiency is illustrated by using a dictionary to store intermediate values in computing
    _____
    .
    Hint

    This example from the lecture showed time savings by storing prior results.

    Answer

    Fibonacci

1 of 26
Question 1 of 26

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent