(a) Write an algorithm (use pseudo-code) to determine whether a function f: Z100 Z100 is surjective....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
(a) Write an algorithm (use pseudo-code) to determine whether a function f: Z100 Z100 is surjective. That is, supply a "Method" to go with Input: A function (array) f with f(i) Z100 for i = 0, 1,...,99. Output: Boolean B. B='true' if f is surjective, 'false' otherwise. Try to make your algorithm as efficient as possible. Do NOT include an implementation of your algorithm in a programming language. (b) How many comparisons does your algorithm perform for a worst case when f is surjective? Count all tests for =, +, < and >. Include all comparisons used, not just comparisons of function values. For example, remember that each pass of a loop will require at least one comparison to test whether the exit condition(s) has/have been met. (a) Write an algorithm (use pseudo-code) to determine whether a function f: Z100 Z100 is surjective. That is, supply a "Method" to go with Input: A function (array) f with f(i) Z100 for i = 0, 1,...,99. Output: Boolean B. B='true' if f is surjective, 'false' otherwise. Try to make your algorithm as efficient as possible. Do NOT include an implementation of your algorithm in a programming language. (b) How many comparisons does your algorithm perform for a worst case when f is surjective? Count all tests for =, +, < and >. Include all comparisons used, not just comparisons of function values. For example, remember that each pass of a loop will require at least one comparison to test whether the exit condition(s) has/have been met.
Expert Answer:
Related Book For
Practicing Statistics Guided Investigations For The Second Course
ISBN: 9780321586018
1st Edition
Authors: Shonda Kuiper, Jeff Sklar
Posted Date:
Students also viewed these programming questions
-
answer all questions as instructed below. attend all questions. 4 Computer Vision (a) Explain why such a tiny number of 2D Gabor wavelets as shown in this sequence are so efficient at representing...
-
answer all questions as instructed below. make sure you have attended all questions .Comparative Architectures (a) Describe the organisation of a two-level branch predictor that makes use of a global...
-
Compute the Regular Pay, Overtime Rate, Overtime Pay, and Gross Pay for each employee. Employees are paid weekly. Filing Employee Status Henry Smith Parker Liam Melanie Total S S S M S Hours Pay...
-
In Finance in a Flat World: International Bonds on page 280, we learned about the bonds issued in financial markets outside of the United States. What are the potential benefits and costs of...
-
The front wheels of a racing vehicle are located far out in front to help keep the vehicle from nosing upward when it accelerates. What physics concepts play a role here?
-
Pick a product like Cadillac or Sara Lee Deli products or service like Mr. Clean Performance Car Wash or a car and home insurance company that is offered in a limited number of countries. Assess the...
-
Construct a multilevel bill of material for product Z. How many Us are needed to make each Z? How many Ws are needed to make eachZ? Z. (2) (3) (2) (1) (1) (4)
-
At the Natural History Museum, tickets cost $10 for adults and $6 for kids under 12. What would be the total cost for 12 adult tickets and 18 kids tickets? What would be the total cost for a adult...
-
A sequential circuit is given in Figure 4-13. Figure 4-13 (a) Add the necessary logic and/or connections to the circuit to provide an asynchronous reset to state A = 1, B = 0 for signal Reset = 0....
-
A tuning fork of frequency 512 Hz makes 4 beats per second with the vibrating string of a piano. The beat frequency decreases to 2 beats per sec when the tension in the piano string is slightly...
-
What are the most common online payment systems are and how they function?
-
a) A 1795 kg hippopotamus is running towards a hunter at a speed of 2.75 m/s. Calculate the momentum of the hippo. Show all work. 1.79 x 10^3 kgm/s 6.53 x 10^2 kgm/s 6.40 x 10^3 kgm/s 4.94 x 10^3...
-
Discuss the key features of the electronic payment systems needed to support e-commerce and m-commerce.
-
What are some of the challenges and opportunities for the alternative payment methodology?
-
Explain electronic payment payment concept and 3 different methods in use.
-
the basic principle of capital investment is produced an increase in market share
-
The manager of a local convenience store is expanding his line of small toy items. To price these new items, the manager is looking at the prices being charged by competing retailers in his area. For...
-
Repeat Question 9 under the assumption that exposure is just 12.5 years per person on average. Question 9: We will use model assumptions A and B to simulate cancer counts in 10,000 neighborhoods,...
-
State the null and alternative hypotheses for this study. Conduct an ANOVA to analyze the Flower data. Check the normality and equal variance assumptions. State your conclusions based on the p-...
-
The graphs displayed in Figure 9.19 are population cumulative hazard functions for three distributions of the time- to- event random variable T. For each one, sketch a possible corresponding hazard...
-
An old-fashioned tire swing exerts a force on the branch and a torque about the point where the branch meets the trunk. If you hang the swing closer to the trunk, this will --the force and-- the...
-
Which of these objects is in static equilibrium? A. B. C. D.
-
A beam with a pivot on its le ft end is suspended from a rope. Tn which direction is the force of the pivot on the beam? A. B. C. D. E.
Study smarter with the SolutionInn App