mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-11-23 15:40:34 -05:00
| .. | ||
| check_sudoku_board.py | ||
| climbing_stairs.py | ||
| fibonacci.py | ||
| happy_number.py | ||
| playing_with_math.py | ||
| README.md | ||
math, logic, dynamic programming
dynamic programming
- take a recursive algorithm and cache overlapping problems (repeated calls).
- the runtime is given by the number of calls.
- top-down: how can we divide the problem into sub-problems?
- top-down dynamic programming is called memoization.
- bottom-up: solve for a simple case, then figure out for more elements.
examples
python3 fibonacci.py
Testing fibonacci
Fibonacci of 10: 55
python playing_with_math.py
Greatest common divider of 21 and 7 is 7
Prime factors of 21 are [3, 7]