Improving efficiency of Bubble Sort.

Improving efficiency of bubble-sort by checking whether it is already sorted or has become sorted. If it has, break the remaining loops.