This sorting algorithm starts from both ends of an array and find max and min elements of that array limited by the loop control variables and terminate when both loop control varibles become equal.