Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4. [10 points Consider the following functions def any_func_in_list linear (1st): for num in lst: funcnum = func (num) if linear-search(funcnum, lst): return True return

image text in transcribed
4. [10 points Consider the following functions def any_func_in_list linear (1st): for num in lst: funcnum = func (num) if linear-search(funcnum, lst): return True return false def any_func_in_list_binary (1st): radix_sort (1st) # Assume 0(n) for num in lst: funcnum - func (num) if binary_search (funcnum, lst): return True return false Where linear search and binary-search are as discussed in class but modified to return True if the element is in the list and False if it is not found. Assume that radix_sort runs in O(n) time it is not a comparison sort), and that func runs in O(1) time. (a) (2 points What is the best-case (in Big-O form) of any_func_in_list_linear (please also list what that best case is) (b) [4 points What is the worst-case runtime (in Big-O form) of any_func_in_list_linear (please also list what that worst case is) (c) (4 points) What is the worst-case runtime (in Big-O form) of any_func_in_list_binary (please also list what that worst case is)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Theory And Application Bio Science And Bio Technology International Conferences DTA And BSBT 2011 Held As Part Of The Future Generation In Computer And Information Science 258

Authors: Tai-hoon Kim ,Hojjat Adeli ,Alfredo Cuzzocrea ,Tughrul Arslan ,Yanchun Zhang ,Jianhua Ma ,Kyo-il Chung ,Siti Mariyam ,Xiaofeng Song

2011th Edition

3642271561, 978-3642271564

More Books

Students also viewed these Databases questions