Prim's Algorithm Time Complexity

前端 未结 3 793
悲哀的现实
悲哀的现实 2021-01-11 23:17

I was looking at the Wikipedia entry for Prim\'s algorithm and I noticed that its time complexity with an adjacency matrix is O(V^2) and its time complexity with a heap and

3条回答
  •  借酒劲吻你
    2021-01-11 23:55

    I think you read it wrong to some degree. For dense graphs, the article talks about using Fibonacci heaps with time complexity O(E + V log V), which is significantly better.

提交回复
热议问题