bubble sort optimize