Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I understand the ComputeSumPowers algorithm. But what I need help with is implementing the collect data algorithm's code. I tried one version and it didn't
I understand the ComputeSumPowers algorithm. But what I need help with is implementing the collect data algorithm's code. I tried one version and it didn't work the way I wanted it to. If you could help with collecting the data gathered using c++ coding language that would be great! and showing how you plot each given.
. Objectives of this assignment: to explore time complexity and "real time" to "dust off" programming skills What you need to do: 1. Implement a silly (nave and inefficient) algorithm A to compute the sum ax' where where a and x are a real numbers with 0 0) output: a real number equal to 1-14 sum = 0 for i 1 to n prod = 1 for j = 1 to i prod = prod sum = sum +prod return sum = x Program to implement (28 points) answer here State here whether your implementation worked and produced data. Provide here the instructions to compile and execute your program on a Tux machine. collectData(). for n = 100 to 1 (with step 100)// L should be as large as your machine // and your available time allow Start timing // Note current time start ComputeSumPowers (0.25, n) Stop Timing // T (n) Current Time start Store the value n and the values T(n)/vn, T(n)?, and T(n).In(n) in a file F where I (n) is the execution time. // Pay attention do not use n^2. The ^ operator is often not the exponentiation. Rather, it // is - 1 Data Analysis (42 points) T() T(m) T(m) (3*7 points per plot) Use any plotting software (e.g., Excel) to plot the values and in File F as a n n nln(n) function of n (on different graphs). File F is the file produced by the program you implemented. Discuss your results based on the plots you obtain (3*7 points per plot discussion). Do not list here data as tables. Only plots are expected. .... answer here Improve Algorithm A ) a) (12 points) Propose a more efficient algorithm to compute the sum = ax' such that the time 4 complexity grows as n. Use pseudocode to describe it. answer here B) (8 points) Propose a more efficient algorithm to compute the sum - ax such that the time complexity is constant (independent of n). Use pseudocode to describe it. answer here i=1Step 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