Ana içeriğe atla

Kayıtlar

Kasım, 2014 tarihine ait yayınlar gösteriliyor

0-1 Knapsack Solution with Dynamic Programming

I've just written a program to solve Single Knapsack Problem with Dynamic Programming via python. I know my solution is not much pythonic, because of I had a rush a little bit. So, please don't hesitate to contact with me to propose more pythonic way. def giveAsMatrix(f, counter): tmpList = [] f.seek(0) for k in xrange(0, counter): tmpList.append(f.readline().strip().split('\t')) return tmpList Above function returns a str list from a file.