kruskal vs prims time complexity code example Example: kruskal algorithm time complexity Time complexity:- O(ElogV)