Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use pseudocode to describe an algorithm that determines whether a given function

ID: 3005884 • Letter: U

Question

Use pseudocode to describe an algorithm that determines whether a given function from a finite set to another finite set is one-to-one.

Hint: You may assume that the domain is A = {a1,...,am} and the co-domain is B = {b1,...,bn}. The function f : A ? B is given as a set of pairs {(ai, f (ai))|?ai ? A}.

(Rosen 3.1/24, 20 points) Use pseudocode to describe an algorithm that determines whether a given function from a finite set to another finite set is one-to-one. Hint: You may assume that the domain is A (a. am) and the co-domain is B The function f : A B is given as a set of pairs {(ai,f(4))|vai e A). b.,bn)

Explanation / Answer

procedure

find_min(a0, a1, …, an: positive integer)

min := a0

index := 0

for j := 1 to n

if (min >= aj)

then

begin

min := aj

index := j

end