Dynamic Programming Knapsack Solution

A couple of years ago I uploaded a 20 minute video to YouTube explaining how to solve the Knapsack problem using dynamic programming. In the video I used a Python script which was written by Pete Sutton and can be downloaded here. I hope this continues to help students understand the dynamic programming solution to this problem!

Part One

Part Two

Part Three (Finding the Solution)

My Calendar

Hey guys,

I’ve been using iCal more and more to manage my time and have decided to publish it online. You can now view and check my schedule here:


I’ve recently been asked a lot more often when I’m free a lot so this should make scheduling easier!

Note: In order to see everything scheduled please ensure all calendars are selected on the right-hand side (I have five sub-calendars).

Manging Sleep

So over the summer I read Sleep Hacks by SleepWarrior. The book outlines various tricks and tips to managing sleep, focusing on creating strong deep sleep as well as maximising the amount of time you can spend awake. One technique stood out to me, known as the 28-Hour-Day.
The 28-Hour-Day is an alternative to the standard 24-Hour-Day, which condenses the 7 days per week into 6 days per week. The idea being that instead of spending 16 hours awake and 8 hours sleeping, you spend 20 hours awake and 8 hours sleeping. This provides two benefits:

1. You gain an extra 8 hours per week of awake time.
2. The time that you sleep varies throughout the week.

This means that you can go out on certain nights (later in the week) and not have to worry about moving your body clock back come monday morning!

So… here’s my plan for sleep based on this 28-Hour-Day model:

The time I’m awake is in green, and the time asleep is in blue (click to enlarge).


So it should work. The awake time is crucially set so as I don’t miss lectures during the week (unless there are any on Monday afternoon) and I’m able to go out Monday, Friday. Saturday, Sunday (and partially Thursday) nights without having to worry about my body clock.

The sleep plan’s based on the idea to move your body clock forward than it is to move it back. Because over the seven 24-Hour-Days the time when you sleep has moved forward by 6 (days) x 4 (amount of hours later you sleep each day) = 24 hours, after a standard 7 day week you’re back to the start and so on.

So here’s the problem. Today I woke up at 12:00am (Sunday), so in order to start following this plan I need to go to sleep at 12:00am on Monday. It’s now 5:30am on Monday, and so I have to stay awake for another 6.5 hours, which would mean I’ll have been awake for a total of 24 hours. Not the best time to start following the plan it seems, but I’m going to have a stab at it. I’ve just made a fresh coffee and my Lord of the Rings Online subscription has been renewed (I know…)

So let’s see how it goes…

Looking Forward to My Second Year

I’m a student at the University of Manchester, studying BcS Computer Science, and I’m just about to enter my second year. I’m looking forward to the new year, meeting friends, pursuing hobbies and goals, and of course continuing with my subject. I’ve done a considerable amount of reflection over the previous year, and have a few things I’d like to do differently. I’ve also been reading up on Computer Science so I’m hoping to have a bit of a head start.
Over the last week I’ve moved down (from York) to the house where I’ll be letting with four other good friends. I’ve managed to clean and set up my room and things are looking pretty good. I really think it’s important that you ensure you have a nice room you’re pleased with, and matches your style. I need somewhere to call base –  where I can centre myself, chill and make reflections in comfort. I know a lot of people that don’t really make their room their own and to be honest I can’t understand why. Personally, I love putting myself into the room and making sure it’s a place I’m proud of and enjoy being in. It’s base.
So I’ve decorated the place with posters of mountains, tropical beaches, cityscapes and chinese words. I had originally stuck up some sheets of blank paper on my window so as people can’t see in (my room is the front lower bedroom looking out onto the street). Now I’ve begun scribbling down motivating and important quotes that I wish to follow in life, for example,

“What separates the amateurs from the champions is the willingness to go through the pain period”.

I often see them whenever my eyes gaze up from the laptop screen and am sure they’ll soon be embedded into my unconscious and become part of who I am. Which is my aim, of course. I also have a pretty nice long mirror and two lava lamps as which makes a nice addition to my room last year.

Fresher’s week begins tomorrow, so the new year is soon about to begin!

Welcome to the blog and first post.

So I’ve decided to set up a blog! Blogs are starting to become more and more popular, and seem to me to be a great way of sharing information between people. I intend to write whatever I like onto this blog, so expect an unusual mix of philosophy, computing, comedy, politics, lifestyles and other encounters from my personal experiences.

Here’s a recent picture of me from a beach in Crete…

Thanks for reading!