package labone.insertionsort;

public class InsertionSort {
        
        public static void linearSearch(int[] array, int key) {
                boolean foundFlag = false;
                for (int i = 0; i < array.length; i++) {
                        if (array[i] == key) {
                foundFlag = true;
                System.out.println("Linear search returned key " + key
                        + " at index " + i + " in " + Driver.timeElapsed
                        + " millisecond(s).");
                break;
                        }
                }
                if (!foundFlag) {
            ;
            System.out.println(Integer.MIN_VALUE);
            System.out.println("Linear search could not find the key. Time" +
                    " elapsed is " + Driver.timeElapsed + " millisecond(s).");
        }
        }

        public static int binarySearch(int[] array, int key, int min, int max) {
        if (max < min) {
            System.out.println(Integer.MIN_VALUE + "\nBinary search could not "
                    + "find the key. Time elapsed is " + Driver.timeElapsed
                    + " millisecond(s).");
            return Integer.MIN_VALUE;
        }
        else {
            int mid = (min + (max - min) / 2);
            if (array[mid] > key) {
                return binarySearch(array, key, min, (mid - 1));
            } else if (array[mid] < key ) {
                return binarySearch(array, key, (mid + 1), max);
            } else {
                System.out.println("Binary search returned key " + key
                        + " at index " + mid + " in " + Driver.timeElapsed
                        + " millisecond(s).");
                return mid;
            }
        }
        }

    public static void insertionSort(int[] array) {
        int key;
        int i;
        for (int j = 1; j < array.length; j++) {
            key = array[j];
            i = j - 1;
            while((i >= 0) && (array[i] > key)) {
                array[i + 1] = array[i];
                i--;
            }
            array[i + 1] = key;
        }
    }
}

@@ -62,20 +62,16 @@
        %0A
-    
     publ
@@ -134,20 +134,16 @@
         
-    
 boolean 
@@ -169,28 +169,24 @@
             
- 
-   
 for (int i =
@@ -226,36 +226,32 @@
                 
-    
 if (array%5Bi%5D == 
@@ -269,20 +269,16 @@
         
-  
-  
 foundFla
@@ -287,20 +287,16 @@
 = true;%0A
-    
         
@@ -366,36 +366,32 @@
                 
-   
- 
 + %22 at index %22 +
@@ -435,36 +435,32 @@
                 
-    
 + %22 millisecond(
@@ -458,36 +458,32 @@
 lisecond(s).%22);%0A
-    
             brea
@@ -501,34 +501,26 @@
             
-    %7D%0A    
+%7D%0A
             
@@ -513,36 +513,32 @@
 %7D%0A            %7D%0A
-    
             if (
@@ -563,24 +563,18 @@
     
-    ;%0A  
+;%0A
         
   Sy
@@ -561,34 +561,32 @@
       ;%0A        
-  
 System.out.print
@@ -608,20 +608,16 @@
 VALUE);%0A
-    
         
@@ -698,20 +698,16 @@
         
-   
- 
 %22 elapse
@@ -765,33 +765,29 @@
         
-%7D%0A
     
+%7D%0A
     %7D%0A%0A
-    
     publ
@@ -1661,28 +1661,24 @@
 %7D%0A        %7D%0A
-    
     %7D%0A%0A    p

Update InsertionSort.java