Skip to content

Commit 351d29d

Browse files
committed
chore: interview questions
1 parent 0f3cc9d commit 351d29d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

README.md

+22
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@
6161
- [Trees and Graphs](#trees-and-graphs)
6262
- [Route Between Nodes: Given a directed graph, design an algorithm to find out whether there is a route between two nodes.](#route-between-nodes-given-a-directed-graph-design-an-algorithm-to-find-out-whether-there-is-a-route-between-two-nodes)
6363
- [Minimal Tree: Given a sorted increasing order array with unique integer elements, write an algorithm to create a binary search tree with minimal height](#minimal-tree-given-a-sorted-increasing-order-array-with-unique-integer-elements-write-an-algorithm-to-create-a-binary-search-tree-with-minimal-height)
64+
- [Recursion Interview Questions](#recursion-interview-questions)
65+
- [Calculate x to the power n using recursion](#calculate-x-to-the-power-n-using-recursion)
6466
- [References](#references)
6567

6668
## Important thing to remember
@@ -626,6 +628,26 @@ abstract data type (ADT) - ADT is defined as a user point of view of a data type
626628

627629
[Answer for Creating Minimal Tree Interview Question](src/interview-questions/graph/2-minimal-bs-tree.mjs)
628630

631+
632+
### Recursion Interview Questions
633+
634+
#### Calculate x to the power n using recursion
635+
636+
**x to the power n Brute Force**
637+
638+
![x to the power n Brute Force](https://i.imgur.com/wy1ANJ5.png)
639+
640+
641+
**x to the power n using simple recursion un-optimized**
642+
643+
![x to the power n using simple recursion un-optimized](https://i.imgur.com/Ed1sLqi.png)
644+
645+
646+
**x to the power n using optimized recursion with multiple subproblems**
647+
648+
![x to the power n using optimized recursion with multiple subproblems](https://i.imgur.com/Ym3qjhj.png)
649+
650+
629651
## References
630652

631653
- http://btholt.github.io/four-semesters-of-cs/

0 commit comments

Comments
 (0)