Managers and Engineers

Computer Science Level pending

The FBI has surrounded the headquarters of the Norne corporation. There are n n people in the building. Each person is either an engineer or a manager. All computer files have been deleted, and all documents have been shredded by the managers. The problem confronting the FBI interrogation team is to separate the people into these two classes ​so that all the managers can be locked up and all the engineers can be freed. Each of the n n people knows the status of all the others. The interrogation consists entirely of asking person i i if person j j is an engineer or a manager. The engineers always tell the truth. What makes it hard is that the managers may not tell the truth. In fact, the managers are evil geniuses who are conspiring to confuse the interrogators.

Your task is to identify one engineer or manager. This is because after identifying an engineer, he can tell who are the managers, or if you identify the manager, he will confess and tell who are the remaining managers.

You perform the following algorithm - maintain three sets of people: UNSEEN, STACK, and DISCARD. Initialize the process by picking one arbitrarily to be the STACK, everything else is UNSEEN. Repeat the following step until UNSEEN is empty:

  • Pick an UNSEEN person x x , remove it from UNSEEN.
  • Ask the top of the STACK y y about x x .
  • If y y says "manager" pop y y off the stack and DISCARD both x x and y y .
  • If y y says "engineer" add x x to the top of the STACK.

After UNSEEN is empty, what can we say about the top of the STACK?

Assume that there are more engineers than managers.

Engineer We could not identify Manager

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

0 solutions

No explanations have been posted yet. Check back later!

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...