added O(lg n) algorithm to compute the power of base^exp