Question

Subject Name: Design and Analysis of Algorithm 1. An array stores 100 keys. Given that the...

Subject Name: Design and Analysis of Algorithm

1. An array stores 100 keys. Given that the unit cost of comparing a key with a search key is c, determine the expected cost of searching the array for the following cases:

(i)   There is equal probability of finding the search key in any of the cells.

(ii) There is 60% chance that the key is in the first 50 cells and 40% chance that the   search key is in the next 50 cells.

(iii) There is 66% chance that the key is in the array, and 44% chance that the key is not in the array.

Homework Answers

Answer #1

Ans

i) There is equal probability of finding search key in any of the cells.

Then search begin from start till end.

Cost = c, 2c,3c,4c.,........,100c

Average cost = c+2c+.....+100c/101 = 100*101*c/2*101 = 50c

= 50c

.

.ii) 60% in first half.

Cost = 0.6(c,2c,3c,4c......50c) + 0.4(51c,52c,.....100c)

= 0.6(c*(50)(51)/2) + 0.4((100*101-50*51))/2)/101

765c+1510c /101

22.52 c

.

.

iii) 66% key is in array

for key in array average cost = 50c from i)

cost for not in array = 100c

cost = 0.66*50c + 0.34*100c

= 67c

.

If any doubt ask in the comments.

Please appreciate the work by giving a thumbs up.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary rivals? How will the acquisition of Reebok by Adidas impact the structure of the athletic shoe industry? Is this likely to be favorable or unfavorable for New Balance? 2- What issues does New Balance management need to address? 3-What recommendations would you make to New Balance Management? What does New Balance need to do to continue to be successful? Should management continue to invest...
MATHEMATICS 1. The measure of location which is the most likely to be influenced by extreme...
MATHEMATICS 1. The measure of location which is the most likely to be influenced by extreme values in the data set is the a. range b. median c. mode d. mean 2. If two events are independent, then a. they must be mutually exclusive b. the sum of their probabilities must be equal to one c. their intersection must be zero d. None of these alternatives is correct. any value between 0 to 1 3. Two events, A and B,...
In February 2012, the Pepsi Next product was launched into the US market. This case study...
In February 2012, the Pepsi Next product was launched into the US market. This case study provides students with an interesting insight into PepsiCo’s new product process and some of the challenging decisions that they faced along the way. Pepsi Next Case Study Introduction Pepsi Next was launched by PepsiCo into the US market in February 2012, and has since been rolled out to various international markets (for instance, it was launched in Australia in September 2012). The new product...
Please read the article and answear about questions. Determining the Value of the Business After you...
Please read the article and answear about questions. Determining the Value of the Business After you have completed a thorough and exacting investigation, you need to analyze all the infor- mation you have gathered. This is the time to consult with your business, financial, and legal advis- ers to arrive at an estimate of the value of the business. Outside advisers are impartial and are more likely to see the bad things about the business than are you. You should...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how the firms resources incompetencies support the given pressures regarding costs and local responsiveness. Describe entry modes have they usually used, and whether they are appropriate for the given strategy. Any key issues in their global strategy? casestudy: Atlanta, June 17, 2014. Sea of Delta employees and their families swarmed between food trucks, amusement park booths, and entertainment venues that were scattered throughout what would...
Sign In INNOVATION Deep Change: How Operational Innovation Can Transform Your Company by Michael Hammer From...
Sign In INNOVATION Deep Change: How Operational Innovation Can Transform Your Company by Michael Hammer From the April 2004 Issue Save Share 8.95 In 1991, Progressive Insurance, an automobile insurer based in Mayfield Village, Ohio, had approximately $1.3 billion in sales. By 2002, that figure had grown to $9.5 billion. What fashionable strategies did Progressive employ to achieve sevenfold growth in just over a decade? Was it positioned in a high-growth industry? Hardly. Auto insurance is a mature, 100-year-old industry...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT