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

Other questions on the subject: Engineering

image
Engineering, 04.07.2019 18:10, sarahgrindstaff123
Afluid flows with a velocity field given by v=(x/t)i.. determine the local and convective accelerations when x=3 and t=1.
Answers: 2
image
Engineering, 04.07.2019 18:10, lowkeyqueenk
Apipe with an outside diameter of 15 cm is exposed to an ambient air and surrounding temperature of -20°c. the pipe has an outer surface temperature of 65°c and an emissivity of 0.85. if the rate of heat loss from the pipe surface is 0.95 kw per meter of length, the external convective heat transfer coefficient (h) is: (a) 12.5 w/m"k (b) 18.6 w/mk (c) 23.7 w/mk (d) 27.9 w/mk (e) 33.5 w/mk
Answers: 1
image
Engineering, 04.07.2019 18:20, rbgrh9465
An open feedwater heater operates at steady state with liquid entering at inlet 1 with t? = 40°c and pl = 1 .2 mpa. water vapor att2-200°c and p2 = 1.2 mpa enters at inlet 2. saturated liquid water exits with a pressure of pa 1.2 mpa. neglect heat transfer with the surroundings and all kinetic and potential energy effects, determine the mass flow rate of steam at inlet 2 if the mass flow rate of liquid water at inlet 1 is given as 2 kg/s.
Answers: 3
image
Engineering, 04.07.2019 19:20, amandaaarmentaa
Acircular pipe of 30mm outside diameter is placed in an airstream at 30 c and latm pressure. the air moves in cross flow over the pipe at 20 m/s, while the outer surface of the pipe is maintained at 110 c. what is the drag force exerted on the pipe per unit length? what is the rate of heat transfer from the pipe per unit 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 in other subjects: