Question
There are n stationary cell-phones c1, ..., cn and n stationary cell-phone towers t1, ..., tn. The distances between cell-phones and towers are given to
There are n stationary cell-phones c1, ..., cn and n stationary cell-phone towers t1, ..., tn. The distances between cell-phones and towers are given to you in an n n matrix d, where d[i, j] denotes the distance between phone ci and tower tj .
It is possible for a cell-phone ci to connect to a tower tj if and only if the distance between ci and tj is at most D, where D is the connecting radius.
Furthermore, at one time, a cell-phone can connect to at most one tower and a tower can allow at most one connection.
Your job is to figure out whether all cell-phones are usable simultaneously.
That is, whether it is possible for all cell-phones to connect simultaneously to distinct towers.
Write a pseudocode for an algorithm that takes inputs n, D, and the distance matrix d, and outputs yes if it is possible for all cell-phones to simultaneously connect to distinct towers (within the connecting radius D) and no otherwise; and analyze running time.
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