sicp-solutions/chapter-2/ex-2.72.txt
2025-09-11 13:00:45 +02:00

12 lines
664 B
Text

Searching a single node requires on the order of k operations, where
k is the number of symbols given at that node.
If the tree is roughly balanced, then the number of symbols listed in
each node on the way down should decrease exponentially, and the number
of these searches would be on the order of O(log(n)), where n is the
number of symbols generally available for encoding.
If this is true, than each encoding of a symbol would take on the order
of O(n*log(n)) operations, however if the tree is very unbalanced,
which is the case in exercise 2.71, the order of growth is roughly
O(n^2), for the least frequent symbols, and O(n), for the most common
symbol.