Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heap image is misleading #85

Open
SamuelYvon opened this issue May 18, 2018 · 1 comment
Open

Heap image is misleading #85

SamuelYvon opened this issue May 18, 2018 · 1 comment

Comments

@SamuelYvon
Copy link

The heap.png image in the readme (https://raw.githubusercontent.com/kdn251/interviews/master/images/heap.png) shows a tree that does indeed respect the heap order property. The problem is when you mention the time complexities. In order to have O(log(n)) insert / remove time you also need for your heap to be a complete binary tree. The heap in the picture is not a complete binary tree. I think it should at least be mentioned in the description that the property is only valid for such trees, otherwise it is somewhat misleading.

@AdityaPai2398
Copy link

You're right, The tree added doesn't follow the heap properties.

In order for a Binary Tree to be considered a heap, it must meet two criteria.

  1. It must have the heap property.
  2. it must be a complete tree.

They have added a wrong representation image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants