Question
In an event, there are n products displayed in a row for the buyers. Every product has some/no review comments given to it in an
In an event, there are n products displayed in a row for the buyers. Every product has some/no review comments given to it in an integer array reviews. (Assume that these are all good reviews only if present) You are allotting price values for these products based on the following requirements: Each product should have a minimum price value assigned to it starting with 1. Products with higher reviews get more price value assigned than its adjacent products. Return the total minimum price value for these products. Note: You can assign price values starting with 1, 2, 3..and so on.
Constraints: n == reviews.length 1 <= n <= 2 * 10000 0 <= reviews[i] <= 2 * 10000
Requirements
1. Formulate an efficient algorithm using Greedy Technique. 2. Implement the above problem statement using Python 3.7
3. Read the input from a file (inputPS02.txt) and Print the sequence of events and total time taken for the entire queue of processes to be executed. 4. You will output your answers to a file (outputPS02.txt) for each line. 5. Perform an analysis for the features above and give the running time in terms of input size: n along with justification.
Example Input:
Sample Input: Input will be taken from the file(inputPS02.txt) . Sample Input Example A. reviews = [1,0,2] B. reviews = [1,2,2] Sample Output: Display the output in outputPS02.txt. A. 5 Explanation: (This is only written for your understanding, you dont need to output the explanation) You can assign to the first, second and third product with 2, 1, 2 price values respectively. B. 4 Explanation: (This is only written for your understanding, you dont need to output the explanation) You can assign to the first, second and third product with 1, 2, 1 price values respectively. The third product gets a price value of 1 because it satisfies the above two conditions.
Note that the input/output data shown here is only for understanding and testing, the actual file used for evaluation will be different
1. Deliverables
1. PDF document designPS02_
2. [Group id] _Contribution.xlsx mentioning the contribution of each student in terms of percentage of work done. Columns must be Student Registration Number, Name, Percentage of contribution out of 100%. If a student did not contribute at all, it will be 0%, if all contributed then 100% for all. 3. inputPS02.txt file used for testing 4. outputPS02.txt file generated while testing 5. .py file containing the python code. Create a single *.py file for code. Do not fragment your code into multiple files. 6. Zip all of the above files including the design document and contribution file in a folder with the name: [Group id]_A2_PS02.zip and submit the zipped file in canvas. 7. Group Id should be given as Gxx where xx is your group number. For example, if your group is 26, then you will enter G26 as your group id.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started