subject
Engineering, 06.05.2020 07:31 mikeeway33

Suppose you have an array of n items (the "member items") and a separate list of k items (the "test items"). The member items are not stored in any particular order. You want to know which of the k test items belong to the set of member items. Here are two different ways to solve the problem: .

Algorithm 1: Look up each test item in the array of member items, using sequential search. .
Algorithm 2: Sort the array of member items, using an optimal comparison- based sorting algorithm, and then look up each test item in the array of member items using binary search Answer the following questions, and briefly justify your answer to each part.

(a) What is the worst-case running time of Algorithm 1 (asymptotically, in terms
(b) What is the worst-case running time of Algorithm 2 (asymptotically, in terms
(c) For a given value of n, for what values of k is Algorithm 2 at least as efficient as of n and k)? of n and k)? Algorithm 1?

ansver
Answers: 3

Another question on Engineering

question
Engineering, 04.07.2019 18:10
Ajournal bearing has a journal diameter of 3.250 in with a unilateral tolerance of 20.003 in. the bushing bore has a diameter of 3.256 in and a unilateral tolerance of 0.004 in. the bushing is 2.8 in long and supports a 700-lbf load. the journal speed is 900 rev/min. find the minimum oil film thickness and the maximum film pressure for both sae 20 and sae 20w-30 lubricants, for the tightest assembly if the operating film temperature is 160ยฐf. a computer code is appropriate for solving this problem.
Answers: 3
question
Engineering, 04.07.2019 18:20
Air is compressed isentropically from an initial state of 300 k and 101 kpa to a final temperature of 1000 k. determine the final pressure using the following approaches: (a) approximate analysis (using properties at the average temperature) (b) exact analysis
Answers: 1
question
Engineering, 04.07.2019 18:20
Apiston-cylinder device contains 0.1 m3 of liquid water and 0.9 m3 of water vapor in equilibrium at 800 kpa. heat is transferred at constant pressure until the temperature of water reaches 350 ยฐc. determine (a) the quality of water at the initial state (b) the work associated with this process, (c) the heat associated with this process.
Answers: 2
question
Engineering, 04.07.2019 19:10
Ahelical coil spring has a mean diameter of 50 mm, a wire diameter of 5.5 mm and is wound with a pitch of 10 mm. the spring steel has an ultimate strength of 1250 mpa. find the force needed to compress the spring solid and the wire stress in this condition. state whether the spring will return to its initial length.
Answers: 1
You know the right answer?
Suppose you have an array of n items (the "member items") and a separate list of k items (the "test...
Questions
question
Mathematics, 10.03.2021 03:30
question
Arts, 10.03.2021 03:30
question
Spanish, 10.03.2021 03:30
Questions on the website: 13722361