What do you need to know to learn algorithms?

Quora Feeds

Active Member
Henry Fontanier


MIT 6.006 Introduction to Algorithms, Fall 2011 is available on the MIT OpenCourseWare Youtube account. It is an amazing course and I learned a good part of what I know about algorithms by watching this.

Watching the course is not enough though, you need some projects to implement the data structures and algorithms.

You can find some on google, but I will give you a good one :

You are given as input an anthill and an amount of ants. The anthill contains rooms that are linked by tubes. One of these rooms is the entry and another one is the exit. Only one ant can be in each room at a time (except for the entry and the exit). Each cycle, every ant on the graph can move from a room to another one by going through a tube. The goal is to write an algorithm to make all of the ants go from entry point to exit point in the minimum amount of cycles.

You will take as input :

  • number of ants (an integer value)
  • rooms (defined by a string, like "ab" or "xx")
  • links (like "ab-xx")
  • The start room will be preceded by ##start and the end room will be preceded by ##end

Therefore,

30
##start 1 2 3 4 5 6 7 ##end 0
0-4 0-6 1-3 4-3 5-2 3-5 4-2 2-1 7-6 7-2 7-4 6-5


Means you have to help 30 ants go from the room 1 to the room 0. The graph will look like :


Then you have to output the moves for each cycle.

This is just an example of a nice project, obviously you can find a lot of other projects to learn algorithms. The good thing about this one is that it will help you get familiar with Dijkstra's shortest path, with BST (or at least linked lists) and with graphs.

Good luck!



See Questions On Quora

Continue reading...
 

Similar threads

Top