Exercise 2.72

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) log2n <= d <= n-1 (unbalanced) which is growth O(n)

The overall is encode is O(n2)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s