Fixed bug in testcase, and the Algorithms concerning the number of comparisons