Heaps

Поделиться
HTML-код
  • Опубликовано: 10 янв 2025

Комментарии • 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).