From a1462cfafb5ab39afe69091ca473714ad4248551 Mon Sep 17 00:00:00 2001 From: Haripriya <93302077+Haripriya-1212@users.noreply.github.com> Date: Fri, 6 Oct 2023 10:48:07 +0530 Subject: [PATCH] Create kruskals.cpp kruskal's algorithm --- greedy_algorithms/kruskals.cpp | 86 ++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 greedy_algorithms/kruskals.cpp diff --git a/greedy_algorithms/kruskals.cpp b/greedy_algorithms/kruskals.cpp new file mode 100644 index 000000000..6a67ddb1b --- /dev/null +++ b/greedy_algorithms/kruskals.cpp @@ -0,0 +1,86 @@ +#include +using namespace std; + +void printArray(int arr[3][100],int n){ + for(int i=0;i<3;i++){ + for(int j=0;j weight 1 => parent1 2 => parent2 + + // find all non zero weight edges + int k = 0, n=0; + for(int i=0;i