Write a function linear_Search_uniq () to search a key from a list of non-unique numbers. (a)The function
Fantastic news! We've Found the answer you've been seeking!
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 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.
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date: