If we have word "banana" and we want to use bottom up heap construction for sorting , the parent in each node will be greater than or equal to the both child, but how to compare between ex a and n , n here is bigger than a but why?
I'm not sure I understand your question.
- Are you asking why the hep is construct bottom up
- Or area you asking why 'n' compares greater than 'a'.
The answer to the second part is easy. You're comparing the ascii values.
See https://www.asciitable.com/
Lower case 'a' has a decimal value of 97.
Lower case 'n' has a decimal value of 110.
110 is greater than 97.