The growth of `encode`

is t * d where t is the number of tokens at particular tree level and

d is the height / depth of the tree.

For a tree of n tokens

1 <= t <= n and so the growth of searching for a token t is O(n)

(balanced) log_{2}n <= d <= n-1 (unbalanced) which is growth O(n)

The overall is encode is O(n^{2})

### Like this:

Like Loading...

*Related*