This is uncached. It has O(2^n)
time complexity.
def fib(n):
return n if n < 2 else fib(n-1) + fib(n-2)
We can pretty easily make this O(n)
by introducing a caching decorator.
This is uncached. It has O(2^n)
time complexity.
def fib(n):
return n if n < 2 else fib(n-1) + fib(n-2)
We can pretty easily make this O(n)
by introducing a caching decorator.
#include <stdio.h> // fprintf, stdout | |
#include <stdlib.h> // malloc | |
#include <getopt.h> // getopt_long, option, required_argument | |
#include <string.h> // strcmp | |
#include "gfclient.h" | |
#define USAGE \ | |
"usage:\n" \ | |
" webclient [options]\n" \ |
from functools import wraps | |
def methodize(dec): | |
"""Decorates a function decorator so it can wrap methods. | |
Usage: | |
``` | |
@methodize(decorator) | |
function(self, *args, **kargs): | |
#... |
$ optirun --debug glxgears | |
[ 682.669476] [DEBUG]optirun version 3.0-51-ga00f533 starting... | |
[ 682.669494] [DEBUG]Active configuration: | |
[ 682.669497] [DEBUG] bumblebeed config file: /etc/bumblebee/bumblebee.conf | |
[ 682.669500] [DEBUG] X display: :8 | |
[ 682.669503] [DEBUG] LD_LIBRARY_PATH: | |
[ 682.669505] [DEBUG] Socket path: /var/run/bumblebee.socket | |
[ 682.669507] [DEBUG] VGL Compression: proxy | |
[ 682.686906] [INFO]Response: No - error: [XORG] (EE) RADEON(0): [drm] failed to set drm interface version. |