diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2016-11-14 06:47:04 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-11-14 06:47:04 +0100 |
commit | 3d5576f485f69b8a2f919a4d5421e16d90197fcd (patch) | |
tree | 4b2c4a529bfc77b04b2ebe70f20464177c0a203c /03-algorithms_on_graphs/05-minimum_spanning_tree/02-clustering | |
parent | f12e0947b27d5d66983d9ce2f0ad2732fbb373c9 (diff) | |
download | coursera-3d5576f485f69b8a2f919a4d5421e16d90197fcd.zip coursera-3d5576f485f69b8a2f919a4d5421e16d90197fcd.tar.gz |
Algorithms : add 03-algorithms_on_graphs 05-minimum_spanning_tree
Diffstat (limited to '03-algorithms_on_graphs/05-minimum_spanning_tree/02-clustering')
5 files changed, 54 insertions, 0 deletions
diff --git a/03-algorithms_on_graphs/05-minimum_spanning_tree/02-clustering/clustering.cpp b/03-algorithms_on_graphs/05-minimum_spanning_tree/02-clustering/clustering.cpp new file mode 100644 index 0000000..31f00e1 --- /dev/null +++ b/03-algorithms_on_graphs/05-minimum_spanning_tree/02-clustering/clustering.cpp @@ -0,0 +1,28 @@ +#include <algorithm> +#include <iostream> +#include <iomanip> +#include <cassert> +#include <vector> +#include <cmath> + +using std::vector; +using std::pair; + + + +double clustering(vector<int> x, vector<int> y, int k) { + //write your code here + return -1.; +} + +int main() { + size_t n; + int k; + std::cin >> n; + vector<int> x(n), y(n); + for (size_t i = 0; i < n; i++) { + std::cin >> x[i] >> y[i]; + } + std::cin >> k; + std::cout << std::setprecision(10) << clustering(x, y, k) << std::endl; +} diff --git a/03-algorithms_on_graphs/05-minimum_spanning_tree/02-clustering/tests/01 b/03-algorithms_on_graphs/05-minimum_spanning_tree/02-clustering/tests/01 new file mode 100644 index 0000000..0acb182 --- /dev/null +++ b/03-algorithms_on_graphs/05-minimum_spanning_tree/02-clustering/tests/01 @@ -0,0 +1,14 @@ +12 +7 6 +4 3 +5 1 +1 7 +2 7 +5 7 +3 3 +7 8 +2 8 +4 4 +6 7 +2 6 +3 diff --git a/03-algorithms_on_graphs/05-minimum_spanning_tree/02-clustering/tests/01.a b/03-algorithms_on_graphs/05-minimum_spanning_tree/02-clustering/tests/01.a new file mode 100644 index 0000000..fafa50f --- /dev/null +++ b/03-algorithms_on_graphs/05-minimum_spanning_tree/02-clustering/tests/01.a @@ -0,0 +1 @@ +2.828427125 diff --git a/03-algorithms_on_graphs/05-minimum_spanning_tree/02-clustering/tests/02 b/03-algorithms_on_graphs/05-minimum_spanning_tree/02-clustering/tests/02 new file mode 100644 index 0000000..62bb252 --- /dev/null +++ b/03-algorithms_on_graphs/05-minimum_spanning_tree/02-clustering/tests/02 @@ -0,0 +1,10 @@ +8 +3 1 +1 2 +4 6 +9 8 +9 9 +8 9 +3 11 +4 12 +4 diff --git a/03-algorithms_on_graphs/05-minimum_spanning_tree/02-clustering/tests/02.a b/03-algorithms_on_graphs/05-minimum_spanning_tree/02-clustering/tests/02.a new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/03-algorithms_on_graphs/05-minimum_spanning_tree/02-clustering/tests/02.a @@ -0,0 +1 @@ +5 |