Sunday, 21 October 2012

Closed Form by Unwinding

The main topic of this week is to find the close form and prove the upper bound of a given program. Proofing the upper bound I found is relatively easy, because we only have to proof the inequality. We can always make a bigger approximation of the given equation, which it doesn't have to be exact. However, when finding the closed form, we have to analyze the pattern carefully and find the exact equation that will cover the whole set. And the best way to understand the process is working through a problem.

In tutorial 4 question 2 is to find the closed form of T(n). Given n is a power of k; substitute 3^k into T(n). T(n) = 3T(3^(k-1)) + 3^2k, and substitute T(3^(k-1)) = 3T(3^(k-2)) + 3^(2k-1). So, T(n) = 3^2T(3^(k-1)) + 3^(2k-1)(1 + 3). And substitute repeatedly until T(3^(k-k)). The main goal in unwinding is to find the pattern, and I found that if this process repeated k times, the pattern of T(3^k) seems to be 3^k + 3^(k+1)(3^0 + 3^1 + ... + 3^(k-1)). This is the closest I can get to the closed form of T(n). However, calculating (3^0 + 3^1 + ... + 3^(k-1)) still takes a bit of time, so maybe there is a shorter closed form; which I have to confirm during the tutorial.

No comments:

Post a Comment