added bidirectional bubble sort