Combined algorithms in one loop

Made couts to check timing.
Testing the time taken by the algorithms.