Click here to Skip to main content
15,895,799 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
In Computer Science branch of ABC College of Engineering, there are n students; numbered 0 through n-1(where n is an odd number). As usual, each of the student has some friends within the same branch, and each of them knows how many friends each of the other student has. Friendship is symmetric, so if a student 0 is a friend of student 1, then student 1 is also a friend of student 0. An assignment is given to the students by Prof. XYZ, for which groups of 2 are to be formed within the classroom, for which each student has been asked to submit the name of the student with whom they want to form their assignment group. Each student ‘i’ has got the freedom to choose exactly 1 other student (i+k)%n as his/her partner for the assignment, not necessarily a friend; and each student is free to select anyone. For example, if a student 0 selects student 1 then too student 1 can select any student other than 0 as his group-mate. You being the Prof. XYZ ask each student to submit the "sum of the number of friends each of the student in class have, other than the student himself and the one he chose for the assignment group”. For example, if student 0 selects student 1 for his group, he should submit (the number of friends kid 2 has) + (the number of friends kid 3 has) + ... + (the number of friends kid n-1 has). You are given a vector sumFriends, where the i-th element (0-indexed) is the answer given to you by student i. To make the things complicated for you, some of the students might not be telling the truth. Return "IMPOSSIBLE" if it is impossible for all the given answers to be accurate. Otherwise, return "POSSIBLE".
Posted
Comments
CPallini 14-Sep-11 5:45am    
Please stop posting homework assignments here.

1 solution

If you are going to post your homework, at least try to make it look like you have attempted to do something yourself!

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, or learn the Magic Words: "Do you want fries with that?"
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900