Presentation is loading. Please wait.

Presentation is loading. Please wait.

GROUP MEMBERS Mohamed Saciid nuux BK Mohamed C/khadir Ali Kheyre

Similar presentations


Presentation on theme: "GROUP MEMBERS Mohamed Saciid nuux BK Mohamed C/khadir Ali Kheyre"— Presentation transcript:

1 GROUP MEMBERS Mohamed Saciid nuux BK Mohamed C/khadir Ali Kheyre
Usame Mohamed Muhamed Ahmed Mohamed Hussein Malin

2 HEAP SORT Objectives of learning this topic: Definition of Heap sort
Techniques that uses heap-sort algorithm Max-heap Min-heap Steps of Heap-sort algorithm Performance of heap sort

3 Definition of Heap-sort
Heap sort is one of the sorting algorithms used to arrange a list of elements in order. Heap sort algorithm uses one of these two techniques of Heap Tree. In this sorting algorithm we use Max Heap or Min Heap.

4 Techniques that uses heap-sort algorithm
Max-Heap: when all parent nodes are either greater than or equal to all of its children nodes is called max-heap is way of Descending order. Min-Heap: is when all parent nodes are either less than or equal to all of its children nodes is called min-heap is way of Ascending order.

5 Steps of Heap-sort algorithm
When we are making max-heap we will follow these steps one by one. first build heap or tree using the given elements in the array. Create max heap to sort elements in descending order , and remember parent nodes must greater than or equal to their children nodes.

6 Steps of Heap-sort algorithm
Once we create a heap as max-heap way we swap the root node(first node) with the last node and delete the last node from the heap, but remember the last node you will take as result or sorted element. Lastly you will follow these tree steps until all elements will be sorted.

7 Performance Best case ==========0(n log n)
Average case ========0(n log n) Worst case =========0(n log n)

8 EXAMPLE

9 EXAMPLE

10 EXAMPLE

11 EXAMPLE

12 EXAMPLE

13 EXAMPLE

14 EXAMPLE


Download ppt "GROUP MEMBERS Mohamed Saciid nuux BK Mohamed C/khadir Ali Kheyre"

Similar presentations


Ads by Google