-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path9_Boolean_vals.cpp
More file actions
48 lines (45 loc) · 1.04 KB
/
9_Boolean_vals.cpp
File metadata and controls
48 lines (45 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include<bits/stdc++.h>
using namespace std;
using namespace std :: chrono;
void PG(vector<bool> &arr , int i)
{
if(i==arr.size())
{
// for(auto j: arr)
// cout << j << " ";
// cout << endl;
return;
}
arr[i]=true;
PG(arr,i+1);
arr[i]=false;
PG(arr,i+1);
}
void input_generator(vector<pair<int,int>> &store)
{
for(int n=1 ;n<=20 ;n+=2)
{
vector<bool> arr(n,true);
int t=0 ;
for(int m=1 ;m<=10 ;m++)
{
auto start = high_resolution_clock::now();
PG(arr,0);
auto stop = high_resolution_clock::now();
auto duration=duration_cast<milliseconds>(stop-start);
t+=duration.count();
}
t=t/10;
store.push_back({n,t});
}
}
int main()
{
vector<pair<int,int>> store;
input_generator(store);
cout << "Number of inputs \tTime taken\n\n";
for(auto i :store)
{
cout << i.first << " \t" << i.second << endl;
}
}