title: Max Heapify Algorithm
body: <p>I am bit confused. If I have an array I have to build a tree. To compare the childern I have to know how large my array is in this case its N = 6 so I have to divide it by 2 so I get 3. That means I have to start from index 3 to compare with the parent node. If the child is greater than the parent node then I have to swap it otherwise I don't have to. Then I go to index 2 and compare with the parent if the children is greater than the parent node then I have to swap it. Then index 1 I have to compare with the children and swap it if needed. So I have created a Max heap. <em>But know I don't get it but why do I have to exchange A<a href="https://i.stack.imgur.com/LfF6O.jpg" rel="nofollow noreferrer">1</a> with A[6] then A<a href="https://i.stack.imgur.com/LfF6O.jpg" rel="nofollow noreferrer">1</a> with A[5]. Finally I dont get the Max heap I get the Min Heap? What does Heapify mean?</em> </p>
  
  <p>Thanks alot I appreciate every answer!</p>
  
  <p>One of my exercise is <strong>Illustrate the steps of Heapsort by filling in the arrays and the tree representations</strong> </p>
  
  <p><a href="https://i.stack.imgur.com/LfF6O.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LfF6O.jpg" alt="enter image description here"></a></p>