Here is my scenario:
This problem is couched in terms of liars and truth tellers, but it has real applications in identifying which componants of a complex system are good (functioning correctly) and which are faulty. Assume we have a community of n people and we know an integer number t < n/2, which has the property that most t of the n people are liars. This does not say that there actually are t liars, but only that there are at most t liars.
I assume that the truth-tellers are always truthful and correct and a liar may tells the wrong answer or right answer.
We will identify the liars in the community by successively picking pairs of people, (X, Y ) say, and asking X: Is Y a liar?. The response is either “yes” or “no”;
What is the optimum algorithm(minimum number of steps) to find all the liars?
Random algorithm with optimal expected running time of O(n) and excellent constants:
Majority decides (this is the key observation!).
The key observation is that if we ask everyone about a single individual the majority opinion will have to be correct (since there is a majority of truth tellers). A slight technicality is if we pick a non-liar first and ask everyone else, assuming all liars lie, we will reach a 50-50, so how do we decide which side is telling the truth? That isn’t a problem, since we can only reach a 50-50 if we picked a non-liar in the first place, so our person in question is indeed a truth-teller.
The expected number of people we will have to choose randomly is O(1) (this is the meatiest part of this question, and since it may be homework, I’ll skip the proof, but hint for an easy proof: geometric distribution), which means we will find our truth-teller and reliable source in O(1)*O(n) time, and from there it’s another O(n) till the finish. In total, O(n).