Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Objectives of this assignment: to explore time complexity and real time to dust off programming skills Use This File USE THIS FILE AS THE STARTING
Objectives of this assignment:
to explore time complexity and real time
to dust off programming skills
Use This File
USE THIS FILE AS THE STARTING DOCUMENT YOU WILL TURN IN DO NOT DELETE ANYTHING FROM THIS FILE: JUST INSERT EACH ANSWER RIGHT AFTER ITS QUESTIONPROMPT
IF USING HAND WRITING STRONGLY DISCOURAGED USE THIS FILE BY CREATING SUFFICIENT SPACE AND WRITE IN YOUR ANSWERS.
FAILING TO FOLLOW TURN IN DIRECTIONS GUIDELINES WILL COST A PENALTY.
What you need to do:
Implement a simple algorithm A to compute the sum inaxi where where a and x are a real numbers with x
Collect the execution time Tn of algorithm A as a function of n
Plot the functions Tngn Tngn and Tngn on separate graphs. See below what the functions gn gn
and gn are.
Refer to the analysis of the time complexity your performed for your Module and discuss it in light of the plots you plotted above.
Objective:
The objective of this programming assignment is to implement in your preferred language an algorithm A to compute the sum inaxi where a and x are a real numbers x We are interested in exploring the relationship between the time complexity and the real timewall time For this exploration, you will collect the execution time Tn of Algorithm A as a function of n and plot Tngn Tngn and Tngn on different graphs. Finally, discuss your results: use the plots you will build to determine and justify the time complexity of TnHint: analyze ahead the time complexity Tn of ComputeSumPowers to predict the expected shapes of Tngn Tngn and Tngn
Algorithm A
ComputeSumPowersaxn
inputs: x is a real number with x a is a real number. n is an integer n
output: a real number equal to inaxi
sum
prod x
for i to n
sum sum prod
prod prod x
return asum
Questions
IMPORTANT: The following questions are meant as hints to guide you to analyze, predict, determine, andor justify the shape of time complexities Tn If you are given the plot Tn and asked to determine whether Tn grows like n n nlnnnn lnn or n your task will in general be hard if you just plot Tn The shape of the curve Tn may be misleading as the scales on the x and y vary. A strategy to help determine the asymptotic growth is the following: if we suspect that Tn grows like a function gn then plotting Tngn will help you. Indeed, if Tn grows like a function gn the curve of Tngn will be look like an unmistakable horizontal line for large values of n
The following questions should help you understand why plotting Tngn is helpful and how to decide whether Tn grows like gn
For this assignment, we will suspect that Tn grows as the functions gn gn
or gn:
gnn
gnn
gnn
Insert your answers in THIS file after each question
a Suppose that for n very large, TnKgn where K is a constant.
i point What would then the values of Tngn Tngn and Tngn be respectively? just replace Tn with Kgn
and simplify the expression you get
answer here
ii points Based on the expressions obtained in the previous question, what would then the shapes of the plots Tngn Tngn and Tngn be respectively?
answer here
b Suppose that for n very large, TnKgn where K is a constant.
i point What would then the values of Tngn Tngn and Tngn be respectively? just plug in Tn
and simplify the expression you get
answer here
ii points Based on the expressions obtained in the previous question, what would then the shapes of the plots Tngn Tngn and Tngn be respectively?
answer here
c Suppose that for n very large, TnKgn where K is a constant.
i point What would then the values of Tngn Tngn and Tngn be respectively? just plug in Tn
and simplify the expression you get
answer here
ii points Based on the expressions obtained in the previous question, what would then the shapes of the Tngn Tngn and Tngn be respectively?
answer here
Program to implement points
answer here
Actions to complete:
ssh into a Tux machine
clear the screen on the Tux machine use the command clear
Display the current date use the command date
Compile your program
Execute your program and interrupt it just to show how the execution starts
Take a screenshot of the Tux terminal and insert here below Your screenshot should look like this template screenshot
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