A random algorithm with optimal expected operating time O (n) and excellent constants:
- Choose a random face
- Ask the rest of the people if he is a liar until one of the options (βyesβ or βnoβ) has weight> n / 2 (i.e. until more than n / 2 people give the same answer) .
Most decide (this is a key point!). - , , ( , ).
- , 1.
, , , ( -). , , , , 50-50, , ? , 50-50, -, , , .
, , O (1) ( , , , : ), , O (1) * O (n) , O (n) . O (n).