0

this is an example in my data structure book and for this exercise was written that this is not a max heap,but it doesn't say its reason would you please help me that why it is not a max heap thanks.

       35
      /  \
     /    \
    27    28
   / \    / \
  /   \  /   \
 14   16 20   19
Neil Aitken
  • 7,856
  • 3
  • 41
  • 40
user355002
  • 871
  • 2
  • 10
  • 22

3 Answers3

1

This is a heap tree, but this book is written wrong. Do not follow this book.

Conner
  • 30,144
  • 8
  • 52
  • 73
priyanka
  • 11
  • 1
  • Please provide some explanation of why the book is wrong and what the right answer might be. – Conner Aug 17 '12 at 21:23
0

I thought the definition of a (max) heap is that every node is bigger than all its children. And, therefore, the largest value is always at the root and therefore easy to access. This looks like a heap to me!

dty
  • 18,795
  • 6
  • 56
  • 82
0

you should post the entire question, and if that book actually says that this is not a max-heap then stop reading that book :P

AviD
  • 302
  • 1
  • 6