Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have written a single piece of code that consists of a single for loop with a simple calculation within the loop. I run the

image text in transcribed

I have written a single piece of code that consists of a single "for" loop with a simple calculation within the loop. I run the code two different times on the same computer, timing the execution for each run. The only change that is made between the two different runs is changing the number of loops that are executed. a. (10 points) If run number 1 is expected to loop 1 million times, and run number 2 is expected to loop 1 billion times, which run should take longer (assume CPls are identical)? (Please justify your answer using the performance equation). b. (10 points) If both runs were found to take the identical amount of time, how many instructions were executed for each program? (assume that the time measurements are perfectly accurate and the CPls are identical) C. (5 points) how long did the program run in each case? d. (5 points extra credit) Please explain what might have caused this? (you must correctly answer 3.a-3.c to receive this extra credit)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Seven NoSQL Databases In A Week Get Up And Running With The Fundamentals And Functionalities Of Seven Of The Most Popular NoSQL Databases

Authors: Aaron Ploetz ,Devram Kandhare ,Sudarshan Kadambi ,Xun Wu

1st Edition

1787288862, 978-1787288867

More Books

Students also viewed these Databases questions