Tags » Travelling Salesman Problem

My efforts to solve "Travelling salesman problem" through JavaScript

Some days back I was searching for NP hard problems and I found out this “Travelling salesman problem”. I read about this on Wiki and I thought of solving it through JavaScript. 405 more words

Programming

Writing a brute force algorithm to find the shortest path that visits every square of a maze and returns to the start at the end

After 30-60 hours of work: coming up with the algorithm, implementing the algorithm and debugging the code (the thinking took up the majority of the time – at least 60% of the time was spent on coming up with the algorithm and mentally proving to myself that it was correct, debugging surprisingly didn’t take that long even though I had to fix a non-critical seg fault (it didn’t impact the program’s correctness but made it take about 20-40 seconds to run, removing it made the program run instantly) which could have occurred anywhere in the code – I ended up testing/validating every single function, every loop and every statement in my code before I found the bug, which occurred in the last few lines of code that I entered into the program so with common sense I could have saved a lot of time by just reviewing the last entered code more thoroughly), I finally wrote working C code that takes in a map of a maze and outputs the shortest path through the maze that visits every square and returns to the starting square.

Coding