T(n)=T(√n)+1
had solution T(n)∈O(loglog n)
and were motivated by the fact that
T(n)=2T(√n)+1
had solution
T(n)∈Ω(log n)
.
Prove these two facts.
For the proof of amortized constant rebalancing of red-black trees, the potential function is: number of configurations where a black node has two black children plus two times the number of configurations where a black node has two red children. The argument is organized as follows: notice first that when a rotation is performed, rebalancing ends after possibly one more rotation. Thus, only recolorings can continue with no constant time upper bound. However, all recolorings, except possibly the last, decrease the potential by at least one. Since updates increase the potential by at most a constant, the result follows.