Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <ctime>
- #include <cstdlib>
- #include <iomanip>
- #include <chrono>
- using namespace std;
- using namespace std::chrono;
- template <typename Func>
- // using template function to measure time for sorting algorithms
- void measureSortTime(Func sortFunc, vector<int> &arr, const string &sortName)
- {
- vector<int> arr_copy = arr; // Copy for sorting
- cout << "Starting " << sortName << "..." << endl;
- auto start = high_resolution_clock::now();
- sortFunc(arr_copy);
- auto end = high_resolution_clock::now();
- auto duration = duration_cast<nanoseconds>(end - start).count();
- cout << "Time Taken:\t" << duration << " ns" << endl;
- cout << "----------------------------------------" << endl;
- }
- // Function to generate a vector of random integers
- vector<int> generateRandomArray(int size)
- {
- vector<int> arr(size);
- for (int i = 0; i < size; ++i)
- {
- arr[i] = rand() % size;
- }
- return arr;
- }
- void MatrixChainMulti(vector<int> p , int n ){
- int C [n][n];
- for(int i =0;i<n;i++){
- C[i][i]=0;
- }
- }
- int main()
- {
- vector<int> sizes = {100, 500, 1000, 1500, 2000};
- for (int size : sizes)
- {
- vector<int> d = generateRandomArray(size);
- int n = d.size();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement