10.4

  1. Renee Brien Scarlett Doris Vincent
    Renee Brien Doris Scarlett Vincent
    Doris Brien Renee Scarlett Vincent
    Brien Doris Renee Scarlett Vincent
  2. The list would be sorted in decreasing order.
    1.  
      public static void selectSort(double[] list)
      {
         for (int top = list.length - 1; top > 0; top--)
         {
            int largeLoc = 0;
            for (int i = 1; i <= top; i++)
               if (list[i] > list[largeLoc])
                  largeLoc = i;
            if (top != largeLoc)
            {
               double temp = list[top];
               list[top] = list[largeLoc];
               list[largeLoc] = temp;
            }
         }
      } 
    2. You will most likely spend more time doing the extra comparisons than you would save by avoiding unnecessary swaps.
    1. 1 9 6 8 2 4
      1 2 6 8 9 4
      1 2 4 8 9 6
      1 2 4 6 9 8
      1 2 4 6 8 9
    2.  
      public static void selectSort (double[] list)
      {
         for (int bottom = 0 ; bottom < list.length ; bottom++)
         {
            int smallLoc = list.length - 1;
            for (int i = bottom ; i < list.length ; i++)
               if (list [i] < list [smallLoc])
                  smallLoc = i;
            double temp = list [bottom];
            list [bottom] = list [smallLoc];
            list [smallLoc] = temp;
         }
      } 
  3.  
    public static void selectSort2 (double[] list, int k)
    {
       for (int top = list.length - 1 ; top >= list.length - k ; top--)
       {
          int largeLoc = 0;
          for (int i = 1 ; i <= top ; i++)
             if (list [i] > list [largeLoc])
                largeLoc = i;
          double temp = list [top];
          list [top] = list [largeLoc];
          list [largeLoc] = temp;
       }
    }