// same sub-programs as sorting but different presentation and // more comments class sorting4 { private int toSort[]; private int length; public sorting4(int elems[], int nbElem) { toSort = elems; length = nbElem; } // Buble sort void CommentedBubble() { int indexElement; // index of current analyzed element in the list boolean modified; // true if two elements where swapped int temp; // temporary variable for values exchange modified = true; // in order to make something while (modified) // loop because something to do { modified = false; // maybe sort is finished for(indexElement=0;indexElement toSort[indexElement+1]) // two element in bad order { temp = toSort[indexElement]; // save value toSort[indexElement] = toSort[indexElement+1]; // put good value toSort[indexElement+1] = temp; // and other good value modified = true; // sort is not finished } } } } // Selection sort void CommentedSelection() { int indexElement, j; // two index for examining elements of the list int posCurMin; // position of minimum value int temp; // temporary variable for values exchange for(indexElement=0;indexElement