Data Structures - Heap (Arabic)

Поділитися
Вставка
  • Опубліковано 1 лют 2025

КОМЕНТАРІ • 7

  • @donfeto7636
    @donfeto7636 2 роки тому +2

    6:50: the elements already exist in the array, so what I think he does is just apply the down heapify (reheapification downward) on the elements that are considered as parents nodes which are n//2 elements, and start from down, upward from n//2-1 to 0 heapify each parent with its children to build the heap,.
    so the number of steps will decrease by a factor of 2
    so I think building the heap would still be O(N*logN) but of course, the running time will decrease.

    • @_abdalla2910
      @_abdalla2910 26 днів тому

      level (0): The count of elements = 2^0 = 1, The operation of down heapify of each node = log2(n)-0
      level (1): The count of elements 2^1 = 2, The operation of down heapify of each node = log2(n)-1
      level (2): The count of elements 2^2 = 4, The operation of down heapify of each node = log2(n)-2
      ..............
      .............
      level(log2(n)): The count of elements = 2^log2(n), The operation of down heapify = log2(n)-log2(n) = 0
      Then the total time is 1*(log2(n)-0) + 2*(log2(n)-1) + 3*(log2(n)-2) + .... + 2^log2(n)*0
      if you do analysis the time complexity will be O(n)

  • @itsme_mostafa
    @itsme_mostafa Рік тому

    جزاك الله خيرا كثيرا

  • @abdelrahmanadel8998
    @abdelrahmanadel8998 4 роки тому

    عظمه اقسم بالله

  • @mohamedarab3123
    @mohamedarab3123 3 роки тому

    YOU’RE THE BEST

  • @abdraoufchebli8977
    @abdraoufchebli8977 4 роки тому

    شرح مفهوم.شكراا