Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3 . 2 . 1 : Recursive algorithm: search. String query _ item and a list of alphabetically sorted strings are read from input. Complete

3.2.1: Recursive algorithm: search. String query_item and a list of alphabetically sorted strings are read from input. Complete the search() function:
If query_item is found at index mid_index of the list, output query_item, followed by ' is found at index ' and the value of mid_index.
Else if range_size is 1, output query_item, followed by ' is not in the list'.
Otherwise, output query_item, followed by ' is not found at index ' and the value of mid_index.
def search(all_names, query_item, min_index, max_index):
range_size =(max_index - min_index)+1
mid_index =(min_index + max_index)//2
''' Your code goes here '''
query_item = input()
data_list = input().split()
search(data_list, query_item, 0, len(data_list)-1)

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 Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions

Question

What is DDL?

Answered: 1 week ago