Time Complexity Confusion!!!

Revision en1, by aman_naughty, 2019-06-13 22:02:09

Why does this code get accepted 55539853 and this does not 55539543?

I believe the time complexity of 1st submission is O(k(n+m)) for k bfs and then O(nklog(k)) for sorting each node.

Can someone tell the complexity of the second code because of which it is failing.

For getting s smallest element I am using slog(s) complexity in bfs in 2nd submission.

Tags #graph, #dfs and similar, #running time, analysis


  Rev. Lang. By When Δ Comment
en1 English aman_naughty 2019-06-13 22:02:09 416 Initial revision (published)