Sorting race · Python

Flashcards for Python lesson 6: Functions and recursion

Read the front, say the back to yourself, then open the card.

  • Recursion

    A function that solves a problem by calling itself on smaller parts of it.

  • assert condition

    Stops the program with an error if the condition is False.

  • log₂(n!)

    The fewest yes-or-no comparisons that can tell n! orders apart: the limit for any comparison sort.

  • n² against n·log n

    For 1,000 items: about 500,000 against about 10,000 steps.

  • Passing a function

    for name, sort in [("merge", merge), …]: functions are values, like numbers.

Back to the lesson