Question
Suppose there are two types of professional wrestlers: Babyfaces (good guys) and Heels (bad guys). Between any pair of professional wrestlers, there may or may
Suppose there are two types of professional wrestlers: Babyfaces (good guys) and Heels (bad guys). Between any pair of professional wrestlers, there may or may not be a rivalry. Suppose we have n wrestlers and we have a list of r pairs of rivalries.
(a) Give pseudocode for an efficient algorithm (in Python) that determines whether it is possible to designate some of the wrestlers as Babyfaces and the remainder as Heels such that each rivalry is between a Babyface and a Heel. If it is possible to perform such a designation, your algorithm should produce it.
(b) What is the running time of your algorithm?
(c) Implement your algorithm by writing a program named wrestlers.Input: Input is read in from a file specified in the command line at run time. The file contains the number of wrestlers n(can be odd or even), followed by their names, the number of rivalries r, and rivalries listed in pairs. Note: The file contains only one list of wrestlers and one list of rivalries
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started