Heaps

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 ธ.ค. 2024

ความคิดเห็น • 6

  • @himanshuranjan5575
    @himanshuranjan5575 7 ปีที่แล้ว +10

    I can't believe how easily he has explained a tricky topic.

  • @prabhatjha653
    @prabhatjha653 9 หลายเดือนก่อน

    One quick question, as you have mentioned if i use sorted array as priority queue i would need O(n) time to insert and O(1) time to delete_max, so overall to process n jobs its O(n^2), why can't i insert in a binary search way needing O(logn) to insert and take out in O(1) time making it O(nlogn) and we do not have to move to heaps in that case. Am i missing something?

  • @mahendratonape27
    @mahendratonape27 3 ปีที่แล้ว +1

    Sir could u pls explain operation complexity for 2 dimensional array for priority queue is order n root n...it should be only root n? Please correct

    • @dev_escape
      @dev_escape 2 ปีที่แล้ว

      See, root(n) is the complexity for 1 operation. So for n such operations, time complexity will be n*root(n).