0

I have a complete 19-ary tree on n nodes. I mark all the nodes that have the property that all of their non-root ancestors are either oldest or youngest children (including root). I have to give an asymptotic bound for the number of marked nodes.

I noticed that the

  • first level has one marked node (root(
  • second: 19
  • third: 2 * 19
  • fourth: 2^2 * 19
  • fifth: 2^3 * 19
  • ...
  • k-th : 2^(k-2) * 19

My method was to find the number of marked nodes on the last level and then use recursion to find the number of marked nodes on a complete 19-ary of one level less.

description

But that does not quite work. Am I going the right path?

Justin D.
  • 4,946
  • 5
  • 36
  • 69

1 Answers1

1

Using a recurrence is overly complicated. You have

1 + sum{i = 2 .. k} 19 ( 2 ^ (k-2) ) = 1 + 19 sum{j = 0 .. k-2} 2^j

The summation just adds a range of powers of 2. It's kind of obvious that sum{j=0..n-1}2^j = 2^n-1. Just think of a binary number. Any power of 2 has a single 1 bit. Subtract one, and you have the sum of all lower powers of two!

So using this identity, we have

1 + 19 ( 2^(k-1) - 1 )

For a test we can try a three level tree, k=3, which produces 1 + 19 (4 - 1) = 1 + 19(3). This matches the series you showed as a pattern.

Gene
  • 46,253
  • 4
  • 58
  • 96