kerry wrote:

> need O(n) time
> the array is set[n],
> for(i = 1, i <=n ; i++)
>      if((set[i] & 1) & (set[i + 1] & 1))
>         then miss the number i+1;

ur logic is not satisfied for even the array is in sorted order also.
For sorted array
 we need ( set [ i ] & 1) & ( set [ i + 1 ] & 1) | |  ( set [ i ] & 0 )
& ( set [ i + 1 ] & 0 )
then only ur logic is applicable

Check it once.
If it satisfies give one example to understand code clearly.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to