sanjar-notes / dsa

C++ basics, Data structures and algorithms.
https://sanjar-notes.github.io/dsa/
17 stars 9 forks source link

Recursion base case may not always be useful even if it's logically valid for the base case, is this true? #9

Open sanjarcode opened 2 years ago

sanjarcode commented 2 years ago

This may make writing recursive functions more involved, and less obvious. Basically it'll add need for a basic test of whether the base case is valid for some cases.

This is undesirable, if true.

sanjarcode commented 2 years ago

A problem that has a base case that needs extra observations/test.

Screenshot_20220424-115116_Gallery.png

Screenshot_20220424-115118_Gallery.png

Screenshot_20220424-115120_Gallery.png

Screenshot_20220424-115127_WhatsApp.png

sanjarcode commented 2 years ago

In short, are non-intuitive base cases in recursion possible?