r/codinginterview • • May 14 '20

Power Function using Recursion

  • Powers of 2 (warmup)

  • Exponentiation operator

  • Implement without using exponentiation operator

  • Iterative solution

  • Product accumulator

  • Powers of a given base

  • Recursive implementation in linear time

  • Size of the problem

  • Base cases

  • Reduce and combine

  • Allow negative integer exponents

  • Problem decomposition

  • Recursive case

  • Relationship between reduction step and base case

  • Function to express recursive case

  • Multiple recursive cases

  • Powers in logarithmic time

  • Handling multiple cases and its effect on recursion diagram

  • Recursive function with multiple recursive cases

  • Direct translation of mathematical function to code

https://www.youtube.com/watch?v=66eNlUxLK6s&feature=share

2 Upvotes

2 comments sorted by

View all comments

2

u/nascentmind May 14 '20

Are you referring to the book "Introduction to Recursive Programming" by Manuel Rubio-Sanchez?

I am referring to the same book and revising. The diagrams and exercises look similar.

2

u/bparanj May 14 '20

Yes. That is the best book I have encountered for learning recursion. I am using that as the reference.