|
You are here |
www.jeremykun.com | ||
| | | | |
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... | |
| | | | |
bayesianneuron.com
|
|
| | | | | [AI summary] The user has shared a detailed exploration of optimizing the 0/1 Knapsack problem using dynamic programming with Python and NumPy. They discuss various optimization techniques, including reducing memory usage with a 2-row approach, vectorization using NumPy's `np.where` for faster computation, and the performance improvements achieved. The final implementation shows significant speedups, especially for large-scale problems, and the user highlights the importance of vectorization and efficient memory management in computational tasks. | |
| | | | |
degoes.net
|
|
| | | | | Functional programming has a bit of jargon, but that doesn't have to stop you from understanding core concepts | |
| | | | |
chipnetics.com
|
|
| | | A quick knowledge nugget in regards to programming language options for project analytics on major industrial projects. | ||