




















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





















---- finish the first traversal ----
---- start again ----
1 1 2 23 9 8 10 56 100
2 1 2 9 23 8 10 56 100
3 1 2 9 8 23 10 56 100
4 1 2 9 8 10 23 56 100
---- finish the second traversal ----
---- start again ----
………………….
void bubbleSort (Array S, length n) {
boolean isSorted = false; while(!isSorted) { isSorted = true; for(i = 0; i<n; i++) { if(S[i] > S[i+1]) { int aux = S[i]; S[i] = S[i+1]; S[i+1] = aux; isSorted = false; } }
}
removes the element with the smallest key removeMin
has created such efficient algorithms as Merge Sort.
steps:
more disjoint subsets.