Hacker News new | ask | show | jobs
by anonymoushn 3311 days ago
Binary heaps are more commonly known and nicer to work with in 1-based arrays for the same reason. If arrays are 1-based, a binary heap's node's children are at 2n and 2n+1, and the node's parent is at n/2.

You shouldn't need a branch in a 0-based Braun tree though. (n-1)/2 should be correct all the time.