Submissions Tasks spp, files + the report (word or PDF file). In a cpp file, using the "Experiment time Create 3 functio
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Submissions Tasks spp, files + the report (word or PDF file). In a cpp file, using the "Experiment time Create 3 functio
Submissions Tasks spp, files + the report (word or PDF file). In a cpp file, using the "Experiment time Create 3 functions opLinear(int n), opNlogN(int n), opSquare(int n), opQuadratic(int n): where each one of the will loop in linear, N*Log(N), Quadratic, and Qubic time based on input "n", accordingly. Inside the loop do one operation (e.g. x = 1;). Test your code for the 4 functions using n that ranges by 2¹, where į ranges from 10 to 20 as seen in Table 1.. Table 1: The Experimental time for the 4 functions for 2,where 10<=<20 Function 1 10 11 12 13 14 15 16 17 18 19 20 NlogN Quadratic Linear Time-micSec Time-micSec Time-micSec Create a chart for each function that has the inputs n (ranges from 210 to 220) in MS Excel. Grading Scheme: Cubic Time-micSec Comment on the results as displayed in the charts, comment on the difference between the Theoretical and Experimental times. Include the Table, charts, and comments in the report. 5 marks for the code 10 marks for the full table. 5 marks for charts and comments. I
main.cpp 1 #include <iostream> 2 #include <chrono> 3 using namespace std; 4 using namespace std::chrono; 5- int main() { 6 // some code 7 // record the time before your algorithm starts 8 auto start = steady_clock:: now(); 9 // your algorithm 10 // record the time after your algorithm finishes 11 auto stop = steady_clock::now(); 12 // subtract stop from start to get the duration 13 auto duration duration_cast<microseconds>(stop start); 14 cout << "Elapsed time: " << duration.count() << "microseconds." << endl; 15 // some code 16 return 0; 17 } 18.