Implemented algorithms from coursera Algorithms part 1