AI engineering glossary · Data structures algorithms
What is kruskal's algorithm?
Kruskal's algorithm: An algorithm that builds a minimum spanning tree by sorting all edges by weight and adding each edge in turn unless it would create a cycle, which it checks with a union-find structure. Time is O(E log E).
Kruskal's algorithm: an example
Edges of weight 1, 2, 3 are added first. A weight-4 edge joining two already connected cities is skipped to avoid a loop.
Related terms
More Data structures algorithms terms
- Linear search
- Linked list
- Load factor
- Longest common subsequence
- Longest increasing subsequence
- LRU cache
- Master theorem
- Memoization
Where you learn it
Kruskal's algorithm is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.