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