Time Complexity is O(V^2) using adjacency matrix representation.
The Time Complexity can be reduced,If the input graph is represented using adjacency list, then the time complexity of Prim’s algorithm can be reduced to O(E log V) with the help of binary heap