Week 5: Recursion
This week i learnt how to use recursive functions. I will mix questions one and two together. The first one was to create a Koch curve and the second one was to create a Koch snowflake. Here it the solution to both of these.
![](https://static.wixstatic.com/media/aa724d_52cc116bcd214af880b1e714ccb19b2e.png/v1/fill/w_413,h_488,al_c,q_85,enc_auto/aa724d_52cc116bcd214af880b1e714ccb19b2e.png)
Then again we start with the more advanced questions. The next one was to create a recursive funtion that checks if a given string is palindrome.
![](https://static.wixstatic.com/media/aa724d_59cab93f1a2749b7ba8954312a0096a0.png/v1/fill/w_416,h_173,al_c,q_85,enc_auto/aa724d_59cab93f1a2749b7ba8954312a0096a0.png)
The 5th task was to write a recursive function that perform floor division without using the \\ operator. Here is the solution:
![](https://static.wixstatic.com/media/aa724d_c4571f4c95d64cddaa9d413417791db6.png/v1/fill/w_635,h_217,al_c,q_85,enc_auto/aa724d_c4571f4c95d64cddaa9d413417791db6.png)
And the last task was to create again a recursive function that perform power calculation without using the ** symbol. Solution below:
![](https://static.wixstatic.com/media/aa724d_086014a7ef8048f6a0e0e7794ef1d07f.png/v1/fill/w_434,h_580,al_c,q_85,enc_auto/aa724d_086014a7ef8048f6a0e0e7794ef1d07f.png)