Finding MST using Kruskal's algorithm |
Another algorithm for finding the MSP is Prim's algorithm.
There are cases where there might be more than one possible minimum spanning tree
Finding MST using Kruskal's algorithm |
"Red is current min. Yellow is sorted list. Blue is current item." ~Wikipedia |
Best case | Average Case | Worst Case | |
---|---|---|---|
Quick Sort | O(n log(n)) | O(n log(n)) | O(n²) |
Merge Sort | O(n log(n)) | O(n log(n)) | O(n log(n)) |
Insertion Sort | O(n) | O(n²) | O(n²) |
Selection Sort | O(n²) | O(n²) | O(n²) |
Bubble Sort | O(n) | O(n²) | O(n²) |