Sunteți pe pagina 1din 5

TCS Ignite Open Lab

TCS Ignite Open Lab


Algorithms Challenge

Computers are good at following instructions, but not at reading your mind.
- Donald Knuth
Computer Scientist and author of the seminal multi-volume work The Art
of Computer Programming

TCS Ignite Open Lab

Cover Page:
Ruminating Calf
A ruminating calf drawn in oil pastels greets trainees as they exit our high-tech lecture
hall, signaling a time and space for reflective learning.
Ruminating Calf by J.P. Ignite, TCS
The Artist
J Prabhakar, known as J.P., is a Chennai based artist who specializes in pen-and-ink
line drawings. With no formal education in art, J.P. is entirely self-schooled. Although
his work is focused exclusively on the sacred arts and his themes tend to be temples,
monuments and sculptures, he innovates constantly in terms of technique, technology,
materials, form and content. His pursuit of excellence is a constant source of
inspiration.

TCS Ignite Open Lab

The TCS Ignite Open Lab Algorithms


The Challenge
In this challenge, you will write algorithms to solve two problems.
The Interviewer Candidate Problem

Waiting Room

Interview Room

Refer to the diagram above. It is a walk-in-interview setup having an interview room with
one chair and a waiting room with a number of chairs. The interviewer interviews
candidates in the interview room. When the interviewer finishes interviewing a candidate,
he dismisses the candidate and goes to the waiting room to see if there are other
candidates waiting. If there are, he brings one of them to his room and interviews him. If
there are no candidates waiting, he returns to his chair in the interview room and
continues reading his last unfinished magazine. If there are no unfinished magazines, he
starts reading a new magazine. After he finishes reading one full magazine, he goes to
sleep.
Each candidate, when he arrives, looks to see what the interviewer is doing. If the
interviewer is reading a magazine, the candidate waits for the interviewer to finish
reading the current page of the magazine. Then the candidate enters the interview room
and asks the interviewer to interview him. If the interviewer is sleeping, the candidate
wakes him up and then asks the interviewer to interview him. If the interviewer is
interviewing another candidate, the candidate goes to the waiting room. If there is a free

TCS Ignite Open Lab


chair in the waiting room, the candidate sits in it and waits his turn. If there is no free
chair, then the candidate leaves.
Based on a naive analysis, the above description should ensure that the walk-ininterview functions correctly, with the interviewer interviewing any candidate who arrives
until there are no more candidates, and then reading magazines and/or sleeping until the
next candidate arrives. In practice, there are a number of problems that can occur that
are illustrative of general scheduling problems. Please discuss those problems and
provide an algorithm to solve those problems.
Note: There are two doors between the interview room and the waiting room.
Tip: Read literature on the Dining Philosophers problem
Satyaaki and Yudhistras problem
Imagine that two divisions of the Pandava army are camped outside an enemy camp of
Kauravas commanded by Bhishma. Each division is commanded by its own general;
Saatyaki and Yudhishtra. The two generals can communicate with one another only by
messengers, who might get caught by the Kauravas. After observing the Kaurava camp,
Saatyaki and Yudhistra must each decide independently whether to attack the Kauravas
or not. Then they must each communicate their plan to the other through messengers.
Upon receiving a message from the other, both Saatyaki and Yudhistra must decide a
common plan of action. The Pandavas can succeed only when both Saatyaki and
Yudhishtra attack the Kaurava camp at the same time.
Discuss the above problem in detail and provide a solution to the same. Your
submission must not exceed 4 pages and should either be in .txt, .doc or .pdf format.
Scope and Effort
The total expected effort is about 1 person day.

TCS Ignite Open Lab

Prerequisites
Any science graduate registered in Open Ignite can attempt this challenge. This
challenge requires candidates to have some background in computer science.
Submission Process
Your submission to each of these problems should not exceed 4 pages. The
submissions can be in txt, .doc or .pdf format
Evaluation
You will be evaluated based on the following parameters.
S.No.
1.

Parameter
Originality of your solution

2.

Ability to learn

3.

Clarity in explanation of solution

4.

Ability to work in a team

S-ar putea să vă placă și