Question: Use Python to develop and test a program to solve the following problem. Suppose we have two n - element lists of numbers, Dlist and
Use Python to develop and test a program to solve the following problem. Suppose we have two nelement lists of numbers, Dlist and Ilist. The list Dlist is sorted in decreasing order, and the list Ilist is sorted in increasing order, ie Dlisti Dlisti and Ilisti Ilisti for each i in n You are to write two versions of a function to determine whether there is an i such that Dlisti is equal to Ilisti If there is an index where the elements are equal, your function must return the index; otherwise it must return Your main program will print "YES, equal at index # where # is the index where they are equal; or NO if there is no index where they are equal. Version a Write a function seqsearchDSIS that uses a sequential search to solve this problem where DS is a list in decreasing order and IS is a list in increasing order. It should return the index where the elements are the same or if there is no such index. Version b If you find an index i where the list values are not equal, you should be able to determine whether to search to the right or to the left.. Write a function binsearchDBIB that uses a binary search to solve this problem where DB is a list in decreasing order and IB is a list in increasing order. It should return the index where the elements are the same or if there is no such index.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
