Untitled


SUBMITTED BY: Guest

DATE: June 15, 2013, 4:36 p.m.

FORMAT: Text only

SIZE: 504 Bytes

HITS: 31368

  1. String[] words = {"so", "in", "very", "every", "do"};
  2. public static void sortArray(Comparable[] compTab) {
  3. for (int next=1; next < compTab.length; next++) {
  4. Comparable value = compTab[next];
  5. int this;
  6. for (this = next; this > 0 && value.compareTo(compTab[this-1]) < 0; this--) {
  7. compTab[this] = compTab[this-1];
  8. }
  9. compTab[this] = value;
  10. writeArray(next + " run through: ", compTab);
  11. }
  12. }

comments powered by Disqus