seletion algorithm with unknown elements number

Find missing IP.
find value appers once while others apper twice
nearest repitition
Chapter 11