Data Structures and Algorithms
with Object-Oriented Design Patterns in Java
![]()
For each of the following sorting algorithms, draw a sequence of diagrams that traces the execution of the algorithm as it sorts the sequence S: straight insertion sort, binary insertion sort, bubble sort, quick sort, straight selection sort, heapsort, merge sort, and bucket sort.
![]()
and
indicate whether the sorting algorithm is stable. ![]()
Prove that bubble sort requires at least p passes where
![]()
)
so that it terminates the outer loop when
it detects that the array is sorted.
What is the running time of the modified algorithm?
Hint: See Exercise
.
).
Copyright © 1998 by Bruno R. Preiss, P.Eng. All rights reserved.