Question: Problem 2 . On a distant planet, there is a group ( X ) of ( n ) aliens of type
Problem On a distant planet, there is a group X of n aliens of type AlienX and a group Y of n aliens of type AlienY. Each alien in group X has a distinct IQ level. Similarly, each alien in group Y has a distinct IQ level. There is exactly one alien in group X who has the same IQ level with exactly one alien in group Y We call the two same IQ aliens "partners". We can make only the following comparison: choose an AlienX Xi and an AlienY Yj ask them to look each other in the eye. They both originally are blueeyed. If they have the exact same IQ level, their eyes will turn to green. If Xi has a lower IQ level than Yj their eyes will turn to white, and if Xi has higher IQ level than Yj their eyes will turn to black. This comparison can only be made between an AlienX and an AlienY, in other words, the eyecolor change does not function between same type of aliens. Write an algorithm that will find the partner of each alien. Your algorithm should have an expected running time of On log n
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
