Write a linear search which operates on a non-sorted list


Python Coding

For the first function, write a linear search which operates on a non-sorted list. Do not sort the list before you search for a given value. Call this procedure search1().

For the second function, write a linear search which first sorts the list of values before searching for the given value. Call this procedure search2().

For the final function, incorporate the recursive binary search. Name this function bsearch().

For all three functions, use the following data (copy and paste this list into your code):

listItems = [200, 120, 88, 25, 0, 201, 90, 121, 5, 81, 298, 65, 133, 199, 77, 166, 66, 54, 21, 159, 277, 2, 190, 240, 355, 72, 163, 222, 111, 80, 35, 83, 254, 322, 9, 93, 116, 270, 78, 144, 100, 114, 228, 50, 60, 70, 131, 142, 305, 99, 12, 281, 162, 57, 257, 157, 357, 29, 193]

The value you should search for is 163.

Measure the loops or function calls within each function.
It's okay to use a global variable in the binary search function.

Request for Solution File

Ask an Expert for Answer!!
Python Programming: Write a linear search which operates on a non-sorted list
Reference No:- TGS080250

Expected delivery within 24 Hours