Ad
  • Default User Avatar

    It's using a comparator. Given 'a' (8) and 'b' (2), if "a - b" is POSITIVE, then 'a' MUST be LARGER than 'b'. Therefore, we want 'b' to appear first. if "a - b" is negative then 'a' is SMALLER than 'b', so we want 'a' to appear first. The only thing we care about in "a-b" is the sign of the difference, not the result itself. if the result is = 0, then a = b and we do not care which appears first.