Question: write a python program which accepts as input, an alphabetically sorted of length n and a search character. s and performs both linear search binary

write a python program which accepts as input, an alphabetically sorted of length n and a search character. s and performs both linear search binary search. the program outputs the index atvwhich the search is sucessful, then the index returned should be -1. the program should also display how many companirs are made by each of the following mechanisms before giving the answer. use seperate user defined functions for both the linear search and binary search. case=1 input=acefhjilmoqr //input string q //search character output=9 //index of found location 10 //number of comparisons by linear search 3 //number of comparisons by binary search

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!