Added swapped flag to bubble sort.