Iterative approach, also reports number of comparisons