If the array is sorted you can use binary search. First divide the interval until you find an element for which array [mid] == mid+1.
Then use binary search again: the first number is left of mid the second is right of mid On Jul 29, 1:20 pm, Vijayasarathy K <vijaykan....@gmail.com> wrote: > Consider an array of 'n' elements which contains all except 2 numbers > from 1....(n + 2). How can we find the 2 missing elements? --~--~---------~--~----~------------~-------~--~----~ 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 algogeeks+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---