You are here |
cp-algorithms.com | ||
| | | |
blog.demofox.org
|
|
| | | | An irrational number is a number that can't be represented as a fraction using integers for the numerator and denominator. I'm a big fan of irrational numbers, and one of the biggest reasons for that is that they are great at making low discrepancy sequences, which give amazing results when used in stochastic (randomized) algorithms,... | |
| | | |
www.oranlooney.com
|
|
| | | | A common example of recursion is the function to calculate the \(n\)-th Fibonacci number: def naive_fib(n): if n < 2: return n else: return naive_fib(n-1) + naive_fib(n-2) This follows the mathematical definition very closely but it's performance is terrible: roughly \(\mathcal{O}(2^n)\). This is commonly patched up with dynamic programming. Specifically, either the memoization: from functools import lru_cache @lru_cache(100) def memoized_fib(n): if n < 2: return n else: return memoized_fib(n-1) + memoiz... | |
| | | |
francisbach.com
|
|
| | | | ||
| | | |
www.gregreda.com
|
|
| | Part three of a three part introduction to the pandas library for Python. It is geared towards SQL users, but is useful for anyone wanting to get started with pandas. |