Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The code should be in C#. I'm familiar with the O analysis but am admittedly struggling to work the Stopwatch class. I also need some
The code should be in C#. I'm familiar with the O analysis but am admittedly struggling to work the Stopwatch class. I also need some help with the microsoft excel graphing. C# is familiar to me but I haven't used excel.
Big Oh Timing Fill in the table below and graph the results - use lines on a single graph. Think about what the graph should look like before turning in your answer. n=500 n=1200 n=2000 n=3500 O(n) Oin2) O(n2+n) You must write three different methods where one method is O(n), the second is O(n2), and the third is O(n2+n). Time each method independently from the other two methods. Details: You must have "using System.Diagnostics;" to use the Stopwatch class. Similar to a stop watch: you start the stopwatch object, run your code, then stop the stopwatch object and look at the elapsed time. Example: Stopwatch timer = new Stopwatch(); timer. Start(); // Start the timer // code that you want to time -e.g.double.TryParse("3.14159",out doubleVariable) within loop(s) timer. Stop(); // Stop the timer decimal micro = (decimal)timer.Elapsed.Ticks / 10M; Console.Write("{0,5:F1},", micro); Turn in your code plus the graph - do a screen shot using Ctrl-Alt-Print and crop the image. To graph your results you can use Excel but delete "n=" in the table and use a line graph. To get better results, run each function multiple times, remove outliers, and average the remaining run times. To get different values of n, change n's values and run the program againStep 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