Msn web hosting - 264 Arrays Chapter 7 76 else if (
264 Arrays Chapter 7 76 else if ( key < array[ middle ] ) 77 high = middle - 1; // search low end of array 78 else 79 low = middle + 1; 80 81 } // end BinarySearch 82 83 return -1; // search key not found 84 85 } // end method BinarySearch 86 87 public void BuildOutput( 88 int[] array, int low, int mid, int high ) 89 { 90 for ( int i = 0; i < array.Length; i++ ) 91 { 92 if( i < low || i > high ) 93 outputLabel.Text += ” “; 94 95 // mark middle element in output 96 else if ( i == mid ) 97 outputLabel.Text += 98 array[ i ].ToString( “00″ ) + “* “; 99 else 100 outputLabel.Text += 101 array[ i ].ToString( “00″ ) + ” “; 102 } 103 104 outputLabel.Text += “n”; 105 106 } // end BuildOutput 107 108 } // end class BinarySearchTest Fig. 7.12 Binary search of a sorted array. (Part 3 of 4.)
In case you need quality webspace to host and run your web applications, try our personal web hosting services.