I can't see a way to do this in less than O(n) time, unless I can take
advantage of the way the data is stored. If the numbers were stored in
a simple C-style array, and the numbers were sparsely missing,
something like this could be done:
//This value is to be adjusted based on the character of the data.
int skipVal=100;
for(int i=0;i<n;i+=skipVal) {
if(i!=data[i]) {
//there were some number(s) skipped, now maybe
//iterate through i-skipVal to i to find the ones missing.
}
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---