Question: Python :Modify the Sorted Names program that you wrote for exercise #2 so it allows you to search the array for a specific name. My

Python :Modify the Sorted Names program that you wrote for exercise #2 so it allows you to search the array for a specific name.

My sorted names program is:

inp = [] num = int(input("  Enter the number of elements from stdin ")) print "  Enter the string values from stdin:  " for i in range(int(num)): n = input(num) inp.append(n) print "  Entered string values are  " print(inp) inp.sort() print "  Ascending (alphabetical) order: ", inp 

Additional Problem Requirements: Include a binarySearch function that takes input parameters of the array of names, the size of the array, and the name to search. The binarySearch function should return an integer representing the array position of the found search name or -1 if the search name was not found Create a main module as your program start module. This module should create local variables to initialize the array of names, prompt the user for a name to search, and call the binarySearch function with the appropriate arguments. Use the search function return value to display different descriptive messages indicating whether the search was successful or not. o Only an array of 10 names is used o The array of names has already been populated with values o The array of names has already been arranged in increasing alphabetical order

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!