Question: USE PYTHON a) Write a python function that takes as input list A storing positive integers and its size n, and replaces each unique element

USE PYTHON

USE PYTHON a) Write a python function that takes as input list

a) Write a python function that takes as input list A storing positive integers and its size n, and replaces each unique element of A by-1. For example, if A = [5, 4, 7, 5, 9, 6, 6] then after you run the algorithm, A = [5,-1,-1, 5,-1, 6, 6). You are allowed to use only O(1) of additional memory. This means that is you can use a few variables, but you cannot declare lists or any other data structures whose size depends on n. The header of the python function is given to you: def Unique (A, n) #Your Python code goes here. b) Give the best "big-Oh" characterization of the worst case time complexity of your function above. Express the complexity as a function of the array size n. Explain how you computed the time complexity of your algorithm

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!