Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(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 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
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