Search code examples
algorithmtime-complexitycomplexity-theoryprims-algorithmupperbound

proving upper bound complexity for prim's algorithm


I would like to know how can you prove an upper bound on the time complexity of Prim's algorithm. I know that the time complexity of the Prim's algorithm is O(|E| log |V|),where E is the edge and V is the vertex, but what does it mean by the upper bound on the time complexity?


Solution

  • but what does it mean by the upper bound on the time complexity?

    Your question is generally about upper bound of any algorithm. Upper bound limits the worst case like how "far up" f(x) can go.

    A description of a function in terms of big O notation usually only provides an upper bound on the growth rate of the function. The upper bound for an algorithm is used to indicate the upper or highest growth to indicate the upper or highest growth rate.

    This means that the given algorithm cannot perform worse than this complexity, given its input set.

    So, using binary heap and adjacency for the graph and for ordering the edges by weight, the total time complexity comes out to be O(|E| log |V|).

    Hence, f(x) = O(|E| log |V|).

    It is bounded below this function, when expressed in the Big-O Notation.