Answered step by step
Verified Expert Solution
Question
1 Approved Answer
a) (16 points) Use the code below and run one function at a time with the required values for N and record the actual time
a) (16 points) Use the code below and run one function at a time with the required values for N and record the actual time (e.g. seconds) it takes. You can simply look at your watch to see the how long it takes. Use a desktop or laptop. DO NOT use an online complier. Answer the questions below. 1. runtime_print has the same code as runtime_increment except that instruction 'res res+1' was replaced with 'print...'instruction. Why does runtime_print take more time to run? Answer: 2. runtime_print_long has the same code as runtime_print except that it prints the string given as argument instead of 'A'. Why does runtime_print_long take more time to run? Answer: 3. After you record the time for runtime_increment, pay attention to how the performance gets worse as n gets larger. Do you think a program with such time complexity would be feasible for an application where N is a million? Answer: 4. After you record the time for runtime_pow, notice how much faster the performance deteriorates (i.e. it takes too long to run even for small values of N such as 20). Compare that with runtime_increment and runtime_print (compare both the actual time, and the time complexity). In the table below the code fill in the time complexity (as) and the approximate clock time each function takes to run. You do NOT need to show your derivations for computing . You also do not need to report the exact time. You can say: "S 1 sec", "a few seconds", "a few minutes", "more than 15 minutes #include void runtime increment(int N); void runtime print(int n); void runtime print long(int n, char* long str); int main(void)! // call the functions here and record the time they take. int L = 1000, 1; char str[L+1]; for(i=0; i void runtime increment(int N); void runtime print(int n); void runtime print long(int n, char* long str); int main(void)! // call the functions here and record the time they take. int L = 1000, 1; char str[L+1]; for(i=0; i
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