Skip to content

Instantly share code, notes, and snippets.

View tushuhei's full-sized avatar

Shuhei Iitsuka tushuhei

View GitHub Profile
@tushuhei
tushuhei / dp.py
Created December 3, 2016 08:58
Dynamic Programming Practice
# coding: utf-8
# Dynamic programing: knapsack problem.
# Rewrote the program in the webpage below in Python.
# 動的計画法(ナップサック問題)
# 下記のサイトのコードを Python にて書き直した。
# reference: http://dai1741.github.io/maximum-algo-2012/docs/dynamic-programming/
VALUES = [15, 3, 1, 8, 2, 4]
WEIGHTS = [11, 2, 3, 5, 1, 4]
MAX_WEIGHT = 15
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tushuhei
tushuhei / subexpr.py
Created August 11, 2016 10:33 — forked from anj1/subexpr.py
import types
import tensorflow as tf
import numpy as np
# Expressions are represented as lists of lists,
# in lisp style -- the symbol name is the head (first element)
# of the list, and the arguments follow.
# add an expression to an expression list, recursively if necessary.
def add_expr_to_list(exprlist, expr):
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.