Assignment 7 - Bubble Sort

  1. Getting Started

    Please refer to this page for information on how to work on your assignment.

  2. Implement the Bubble Sort Algorithm

    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.

  3. Keep track of what the algorithm is doing.

    Write out all intermediate values during the sorting process.

  4. Bring algorithm in final form

    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?

  5. Self-Assessment

    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.

JavaScript Starts Here.
JavaScript Ends Here.