CPP Algo
CPP Algo
#include <iostream>
#include <chrono>
using namespace std;
using namespace std::chrono;
int main()
{
// Timing a piece of code using <chrono>
int n=100000;
int sum_it, sum_e;
// Get starting timepoint
// begin = ; your code; end = ;
// elapsed = end - begin
//then print it
cout << "Time taken by sum_iter: " << elapsedSumI.count() << " nanoseconds. " << " The sum (by iteration)
cout << "Time taken by sum_exact: " << elapsedSumE.count() << " nanoseconds. " << " The sum (by exact sol)
//Testing SelectionSort:
//int A[] = {9,-7, 8, 0, 9, 10};
//int size = sizeof(A)/sizeof(int); // size of A
//SelectionSort(A);
InsertionSort2(A, size);
cout << "Time taken by InsertionSort(): " << elapsedI.count() << " nanoseconds. " << endl;
cout << "Time taken by SelectionSort(): " << elapsedS.count() << " nanoseconds. " << endl;