I need to find the minimum missing element from a sequence of non-negative integers.
ex: I have: 0 5 10 4 3 1
The missing element is 2.
In above sequence missing elements are 2 6 7 8 9 . The minimum among them is 2 so answer is 2.
Brute force . I will sort the sequence and get the minimum element in nlogn .I am looking for better solution. Any help ?