Home Robotics C++ Physics II AP Physics B Electronics AP Java Astronomy Independent Study Summer Session Contests  About
                                                       

Sequential Search

 

 

public int linearSearch( int array2[], int key )
   {  
      for ( int counter = 0; counter < array2.length; counter++ )
 
         if ( array2[ counter ] == key ) return counter;
 
      return -1; 
   }