Skip to content

Latest commit

 

History

History
42 lines (35 loc) · 2.15 KB

Class2.md

File metadata and controls

42 lines (35 loc) · 2.15 KB

Class 2: Wednesday, March 22 – Recursion & Search Algorithms

Topics:

Resources:

Challenges:

  • implement iterative factorial function using recursion starter code:
    • implement factorial(n) - the product of the integers 1 through n
    • run python recursion.py number to test factorial on a number
      • example: python recursion.py 8 gives the result factorial(8) => 40320
    • run pytest test_recursion.py to run the recursion unit tests and fix any failures
  • implement recursive linear and binary search algorithms using search starter code:
    • implement linear_search(array, item) - the first index of item in array
    • implement binary_search(array, item) - the index of item in sorted array
    • run pytest test_search.py to run the search unit tests and fix any failures
  • annotate all functions with running time complexity analysis

Stretch Challenges: