Find a missing 32bit integer among a unsorted array containing at most 4 billion ints

Posted by pierr on Stack Overflow See other posts from Stack Overflow or by pierr
Published on 2009-10-29T09:18:40Z Indexed on 2010/05/13 11:14 UTC
Read the original article Hit count: 302

Hi,

This is the problem described in Programming pearls. I can not understand binary search method descrbied by the author. Can any one helps to elaborate? Thanks.

EDIT: I can understand binary search in general. I just can not understand how to apply binary search in this special case. How to decide the missing number is in or not in some range so that we can choose another. English is not my native language, that is one reason I can not understand the author well. So, use plain english please:)

EDIT: Thank you all for your great answer and comments ! The most important lesson I leant from solving this question is Binary search applies not only on sorted array!

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about binary-search