forked from justinhj/astar-algorithm-cpp
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_combination.cpp
More file actions
30 lines (22 loc) · 757 Bytes
/
Copy pathtest_combination.cpp
File metadata and controls
30 lines (22 loc) · 757 Bytes
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
/*
Adapted from Nikos M.'s answer on https://stackoverflow.com/questions/12991758/creating-all-possible-k-combinations-of-n-items-in-c
Oct. 07, 2020
*/
#include <algorithm>
#include <iostream>
#include <string>
#include <chrono>
#include <vector>
#include "get_combination.h"
int main()
{
auto t0 = std::chrono::high_resolution_clock::now();
std::vector<int> result = get_combination(4, 2);
auto t1 = std::chrono::high_resolution_clock::now();
auto time_used = std::chrono::duration_cast<std::chrono::microseconds>(t1 - t0).count();
std::cout << time_used << "microseconds" << std::endl;
for (unsigned long i = 0; i < result.size(); i = i + 2)
{
std::cout << result[i] << ", " << result[i+1] << std::endl;
}
}