Zeitkomplexität Algorithmus von Kruskal?

Ich habe den Algorithmus von Kruskal in Python programmiert. Bin mir aber bei seiner Zeitkomplexität unschlüssig. Im Internet habe ich gefunden, dass diese O(|E|*log(|E|)) sei. Wobei E die Anzahl an Kanten ist. Kann mir das jemand erklären?

(1 votes)
Loading...

Similar Posts

Subscribe
Notify of
1 Answer
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
NoArtFX
1 year ago

Sorting takes O(n log(n)) or O(|E| log(|E|).

After that you only have to look at each item exactly 1 time to check if you can add it to your MST or not. O(1). Since O(|E| log(|E|) > O(1) is your time complexity.