Skip to content

Instantly share code, notes, and snippets.

@astkaasa
Created April 16, 2013 01:57
Show Gist options
  • Save astkaasa/5392765 to your computer and use it in GitHub Desktop.
Save astkaasa/5392765 to your computer and use it in GitHub Desktop.
problem 5.7
public static int findMissing( int[] a ) {
Arrays.sort( a );
if ( fetch( 0, 0 ) != 0 )
return 0;
int max = ( int ) Math.log( n ) / Math.log( 2 );
for ( int i = 1; i < n; i++ ) {
j = ( int ) Math.log( n ) / Math.log( i );
if ( fetch( j, i ) != 1 )
return i;
}
}
//int fetch( int j, int i )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment