big o - Algorithmic Upper Bound for my solution -
i'm working on homework , want create sure analysis of upper bound solution correct.
here's do.
i read n characters input string. // o(n) construct min heap of size k(where k big constant). // o(n) retreive k entries min heap. // o(k *log n).the complexity of solution hence o(n+ k·logn). wondering whether can safely approximate o(n), if take consideration k constant.
yes, if k constant, Θ(n + k log n) = Θ(n) + Θ(k log n) = Θ(n) + Θ(log n) = Θ(n).
big-o time-complexity
No comments:
Post a Comment