Considering $n$ number of pieces of data, what would Dijkstra's shortest path algorithm time complexity be if it was stored using a data structure with following properties?

• delete the record with the minimum value of the key (complexity $O(log n)$);

• decrease the key of some record (complexity $O(1)$);

• find the record with the minimum value of the key (complexity $O(1)$);

• insert a new record (complexity $O(1)$).

I think it would be $O(nlogn)$, but am having trouble proving it. Does anyone have suggestions? Thanks!

  • $\begingroup$ What have you tried? Where did you get stuck? We do not want to just hand you the solution; we want you to gain understanding. However, as it is we do not know what your underlying problem is, so we can not begin to help. See here for tips on asking questions about exercise problems. If you are uncertain how to improve your question, why not ask around in Computer Science Chat? $\endgroup$
    – Raphael
    Dec 11 '17 at 8:11
  • $\begingroup$ Our reference question may be of help. $\endgroup$
    – Raphael
    Dec 11 '17 at 8:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.