Skip to content
START WITH A QUESTION

What would you like to understand?

Find an answer. See the moment it becomes clear. Follow the idea further.

← Concept directory

Answers for “为什么 Prim 算法被认为是贪心算法?”

2 keyword matches

Understanding your question. You can explore the search results below now.

Meet the concept

↗

The time complexity of Prim's algorithm depends on the data structures used. Using an adjacency matrix with searching gives O(V2)O(V^2), while using a binary heap with an adjacency list gives O(Vlog⁡V+Elog⁡V)O(V \log V + E \log V), where VV is the number of vertices and EE is the number of edges.

Conditions: The graph is represented using specific data structures.; VV denotes the number of vertices.; EE denotes the number of edges.

Meet the concept

↗

A minimum spanning tree (MST) is a connected, acyclic subgraph that spans all vertices of a weighted graph and has the minimum possible total edge weight.

Conditions: The underlying graph must be weighted.; The graph must be connected for a spanning tree to exist.; The MST minimizes the sum of selected edge weights.; The MST contains no cycles.