Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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_2

Step: 3

blur-text-image_3

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

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago