Question: Write a function linear_Search_uniq () to search a key from a list of non-unique numbers. (a)The function should take in two arguments: a list and
Write a function linear_Search_uniq () to search a key from a list of non-unique numbers.
(a)The function should take in two arguments: a list and the search key and return a new list containing unique numbers. For example:
a = [1,3,5,4,5,3,4,3,3]
key = 3
linear_Search_uniq(a, key) = [1, 5, 4, 5, 4]
Write two unit test cases for this function.
(b) Write another function selection_sort() that uses the unique list and sorts in ascending order by applying selection sort. Show the number of comparisons in each iteration and the elements that are swapped in each iteration along with the intermediate sorted list in every pass. Write two unit test cases for this function.
Step by Step Solution
3.47 Rating (160 Votes )
There are 3 Steps involved in it
Python functions for the tasks youve described along with two unit test cases for each function a Fu... View full answer
Get step-by-step solutions from verified subject matter experts
