Question

llican chat lor sorted lin of las dy, ...,a, and Ka knEr z. Issarytkard.z, an-。。,a, 》 ale (ni amRkr tbr kikmrg t刱鲫rhelgrithrEK 1. return Land archizq.....«.) procedure Sarrk2l/n-...as) and abo ht,


0 0
Add a comment Improve this question Transcribed image text
Answer #1

a)

i)

Search1: Best case for linear search is O(1) as provided so search1 will take O(1) time

Search2: Seacrh2 will first sort number which takes O(nlogn) in all cases as provided, and binary search takes O(logn) in all cases.

So best case time will be O(nlogn) + O(logn) = O(nlogn)

Search 1 will be better for best case as it takes less time.

b) worst case

Search1: Linear searchs wost case is O(n) so worst case time of Search 1 is O(n)

Search2: Seacrh2 will first sort number which takes O(nlogn) in all cases as provided, and binary search takes O(logn) in all cases., so worst case time will be O(nlogn)

Search1 is better than Search2 as it takes less time in worst case.

Add a comment
Know the answer?
Add Answer to:
llican chat lor sorted lin of las dy, ...,a, and Ka knEr z. Issarytkard.z, an-。。,a, 》...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • POST-LABORATORY QUESTIONS (For full credit show your calculations). us T able enced color of ligh...

    the date is 4/09/19 POST-LABORATORY QUESTIONS (For full credit show your calculations). us T able enced color of light and the coresponding wavelength (om) associated with each cation Barium, Ba2 Copper, Cu2 Sodium, Na Calcium, Ca2 Potassium, K Strontium, Sr2 2. Calculate the energy associated with the light emitted by each of the K', Ca*2 and Li. Ca 2 Ba*2 s Flame Tests & Electron Configuration FLAME TESTS & ELECTRON CONFIGURATION INTRODUCTION AND BACKGROUND The chemistry of an element strongly...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT