rohit_dayal
Questions (1)
Reputation 0
- 46
0of 0 votes
AnswersYou are at a political convention with n delegates, each one a member of exactly one political
- rohit_dayal on March 25, 2012 in United States Edit | Report Duplicate | Flag
party. It is impossible to tell which political party any delegate belongs to; in particular, you will
be summarily ejected from the convention if you ask. However, you can determine whether any
two delegates belong to the same party or not by introducing them to each other—members of the
same party always greet each other with smiles and friendly handshakes; members of different
parties always greet each other with angry stares and insults.
(a) Suppose a majority (more than half) of the delegates are from the same political party.
Describe an efficient algorithm that identifies a member (anymember) of the majority party.
Google Software Engineer / Developer Algorithm
Page:
1
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
