Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For this question, you need to design, analyze, and implement in C + + an algorithm to read an array ( a ) of (
For this question, you need to design, analyze, and implement in an algorithm to read an
array a of int values and a value of and find the degree polynomial.
You need to calculate the execution time for your two algorithms.
An degree polynomial is an equation of the form
where is a constant number and each is an integer number in an array of size
Your program should implement the following operations:
a Randomly initialize as the size of the array.
b Randomly initialize integer values starting from and store them in an array a
inputDataint a int
Call this function to initialize the values of array
c Randomly generate a value for of any value.
d Implement a simple time algorithm for computing for a particular value of
e Implement a simple time algorithm for computing for a particular value of
f Print the time needed to execute each algorithm.
g Print the value of
Requirements:
A The program should calculate and print out the value of using two different algorithms.
The program will measure the time needed to execute the same input but using different
complex algorithms. You are not allowed to use any builtin power function in designing the
algorithms.
B Your program should perform an experimental analysis of their running times by doing the
following:
For each algorithm, choose at least appropriate large values for where is the input
array size, and determine how long it takes to run algorithms in nanoseconds. For
example, value of etc.
Notes:
Try to choose large values for to avoid an erratic timing eg s or there is no
clear increase in time with respect to input size
You are required to use the same values of for both algorithms.
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