educative.io

Time complexity of Network Delay Time

The stated time complexity of the solution is O(ElogN), because our priority queue contains at most N elements. Is it possible that we add more than N elements to our priority queue, if we find multiple paths to an unvisited node? If so, would our time complexity actually be O(ElogE)?


Course: Grokking Coding Interview Patterns in Python - AI-Powered Learning for Developers
Lesson: https://www.educative.io/courses/grokking-coding-interview-patterns-python/solution-network-delay-time