Understanding Time complexity calculation for Dijkstra Algorithm

前端 未结 5 457
囚心锁ツ
囚心锁ツ 2020-12-12 11:17

As per my understanding, I have calculated time complexity of Dijkstra Algorithm as big-O notation using adjacency list given below. It didn\'t come out as it was supposed t

5条回答
  •  醉酒成梦
    2020-12-12 11:52

    In dense(or complete) graph, E logV > V^2

    Using linked data & binary heap is not always best.

    That case, I prefer to use just matrix data and save minimum length by row.

    Just V^2 time needed.

    In case, E < V / logV.

    Or, max edges per vertex is less than some constant K.

    Then use binary heap.

提交回复
热议问题