Question: (a) Let Z 0,1,.,n-1). Write an algorithm (use pseudo-code) to determine whether a function f:Z Z is injective. That is, supply a Method to go

 (a) Let Z 0,1,.,n-1). Write an algorithm (use pseudo-code) to determine

(a) Let Z 0,1,.,n-1). Write an algorithm (use pseudo-code) to determine whether a function f:Z Z is injective. That is, supply a "Method" to go with Input: A number n ? Z and a function (array) f with f(i) ? Zn for i-0, 1, . . . , n-1} Output: Boolean B. B f f is injective, 'false' otherwise. Try to make your algorithm as efficient as possible. You can include an implemen- tation of your algorithm in a programming language if you wish, plus sample input and output. However your program will be treated as back-up only, and ignored if it does not agree with your algorithm, or is not written to be comprehensible to a reader not familiar with your choice of programming language (b) For n 10 how many comparisons does your algorithm use for a worst case when f is injective? Count all tests for-, #, . Include all comparisons used, not just comparisons of function values

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!