sir explained that while using heap time complexity would be n + k logn
but how??
poping takes log n times klogn us ok
how building a heap take n time
each inertion will take o(logn) time should’t it be nlogn+ klogn
plzz clear my doubt
sir explained that while using heap time complexity would be n + k logn
but how??
poping takes log n times klogn us ok
how building a heap take n time
each inertion will take o(logn) time should’t it be nlogn+ klogn
plzz clear my doubt
@yatin Yes you are right. But we can say that in average case, the complexity of building a heap is O(n). Refer this https://www.growingwiththeweb.com/data-structures/binary-heap/build-heap-proof/
ok thank u sir got it