Skip to content

Instantly share code, notes, and snippets.

View novadev94's full-sized avatar

Dai Truong novadev94

View GitHub Profile
@novadev94
novadev94 / memoization.py
Last active October 23, 2016 15:22
Dynamic Programming Memoization in Python
import functools
def memoization(mem_dict):
""" This is a version for modules' functions.
:Parameter - `mem_dict`
A global variable used to store the calculation result
:Usage
fibo_dict = {}
@memoization(fibo_dict)
// C++ includes used for precompiling -*- C++ -*-
// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.