Technical Lead based in Manchester, UK
Knapsack Problem (0-1 solution) - Dynamic Algorithm
I’ve recently dug up old code from my University days, which I thought I’d share for the benefit/misfortune of others.
There’s a common problem in programming called the knapsack problem. Here was my solution based on the dynamic algorithm.
# Math is used to floor/round the floats to an interger and back! import math
Total allowed weight totalWeight = 2392;
Define the items name, Weight, Profit items = ((“Weapon and Ammunition”, 4.…
Read more ⟶
Knapsack Problem (0-1 solution) - Greedy Algorithm
I’ve recently dug up old code from my University days, which I thought I’d share for the benefit/misfortune of others.
There’s a common problem in programming called the knapsack problem. Here was my solution based on the greedy algorithm.
# Name, Weight and Value of Items items = [(“Weapon and Ammunition”, 4.13, 1.4), (“Water”, 2.13, 2.74), (“Pith Helmet”, 3.03, 1.55), (“Sun Cream”, 2.26, 0.82), (“Tent”, 3.69, 2.38), (“Flare Gun”, 3.45, 2.…
Read more ⟶
New Website/Blog Thing
So, for a few years I’ve had a static landing page as my website. I thought it was time for a makeover. This time, rather than posting absolutely anything, I’m going to keep it strictly about coding, development, and tech.
On a side note. I’m slowly opening up more of my GitHub repositories to the public. I’ve got many private repositories, which I started with the intention of releasing as an Open Source projects.…
Read more ⟶