Infinite Array ?
Infinite Array in sorted order ?
Let's say we have an infinite array where each of the elements have a
number (according to which it is sorted) and a valid/invalid bit for
storing the validity.
s - number we are searching for
arr[] - the infinite array
inc = 100; // this is the value you gotta tweak
i=0;
while ( arr[i].val<=s )
i+=inc;
if ( i==0 )
// value not found
else
binary_search(arr[],i-inc,i,s); // arr[], low_lim, hi_lim,
search_number
Guess this is the best that you could get.
But I'm still confused about that "Infinite Array".
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---