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

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
Get step-by-step solutions from verified subject matter experts
