Cheap and Secure Web Hosting Provider : See Now

Heap-like notation of a BST (BFT bit-vectors) for succinct representation

, , No Comments
Problem Detail: 

I'm researching the topic of succinct tree representations right now and came across this presentation. On slide 17 there is an example of heap-like notation of a BST (using BFT bit-vectors) and the author claims that the amount of bits needed to represent a tree of $n$ elements (without their values) is exactly $2n+1$.

According to my calculations, it's $2n-1$. Here they are:

  1. As in this representation every BST is represented as a complete tree, for the complete tree of height $k$ it has $2^{k+1}-1$ nodes.
  2. On average for $n$ nodes tree has a height of $log_2n$.
  3. Replacing the $k$ from the first list item with the average BST height from the second list item I received:


What am I missing in my calculations? Where do these 2 extra bits come from?

Thanks in advance for your answer!

Asked By : ddnomad
Answered By : Pratik Deoghare

You can count it like this:

Let $n$ be the original number of nodes

Each original node has 2 children after adding the external nodes.

So 1 bit for the original node and 2 for its children. Total $3n$ bits.

But we are over counting here because original node is child of one other original node. So we subtract $n$ and get $2n$.

But we over corrected the count because root node has no parent so we add back 1 bit.

$2n + 1$.

Best Answer from StackOverflow

Question Source :

3200 people like this

 Download Related Notes/Documents


Post a Comment

Let us know your responses and feedback