Please refer to this page for information on how to work on your assignment.
The algorithm is on pages 21-23 in Chapter 2 of Harel's Book.
There is a document.write()
statement at the place of the
missing part.
Write out all intermediate values during the sorting process.
Modify the program such that it stops sorting whenever in one
round no pairs of list elements are exchanged.
You can use the ready
variable to track that event down.
For this, you have to delete one appropriate line.
How many rounds does the sorting then need?
After the fifth round, the output should look like this:
List of words after Round 5. a is is list not of but should be put in alphabetical order by bubble sort sorted this which words yet
The total number of rounds must be less than the number of words.