TCS
TCS
on
SnoozyPancake
SnoozyPancake
17mo

Stuck on Recursion πŸ˜΅β€πŸ’«

Hi Everyone,

I recently started revisiting DSA, but I’m struggling with backtracking and recursion again. I find it difficult to think recursively. When I look at others’ solutions, I can understand them, but I’m having trouble coming up with recursive solutions on my own.

I encountered a similar issue during my college days, which led me to quit DSA back then. Does anyone have any advice or tips on how to improve my recursive thinking and make progress with backtracking?

Thanks in advance!

17mo ago
SleepyPenguin
SleepyPenguin
17mo
  • Practice regularly: Start with simple problems and gradually tackle harder ones.
  • Understand base cases: Know when the recursion should stop.
  • Visualize: Draw diagrams or recursion trees.
  • Study patterns: Recognize common recursive patterns.
  • Collaborate: Discuss with peers or join study groups.
SnoozyPancake
SnoozyPancake

Thank you , will follow this tip

JumpyCupcake
JumpyCupcake

Don't go so hard on yourself... Recursion is not an easy concept to grasp...
My advice would try with simple examples ... For example try writing a program to find factorial of a number...
Before writing the code... Write the flow on a piece of paper... Write down the values for every iteration.
It will take some time....

SnoozyPancake
SnoozyPancake

Thank you.

Discover more
Curated from across