Suppose X and Y are finite sets, X has more elements than Y, and
F
:
X
→
Y
is a function. By the pigeonhole principle, there exist elements a and b in X such that
a
≠
b
and
F
(
a
)
=
F
(
b
)
. Write a computer algorithm to find such a pair of elements a and b.
To determine
To write the computer algorithm for finding pair of elements of a and b according to the given information.
Explanation
Given information:
Suppose X and Y are finite sets and X has more elements than Y ; and F:X→Y is a function. By the pigeonhole principle, there exists elements a and b in X such that a≠b and F(a)=F(b)
Calculation:
Let us suppose X has m elements and Y has n elements