Skip to main content
4 of 5
deleted 62 characters in body
Ahmad
  • 1.9k
  • 3
  • 21
  • 36

Are recursive algorithms a declarative approach to solve the problems?

I have noticed many problems in algorithms textbook are solved by recursion (divide and conquer, backtracking,...)

As I tried to enhance my skills in writing them, I have noticed, I just need to translate a recursive definition of the problem to the code. Then I don't even need to know how it will be executed. I thought recursion may naturally belong to declarative programming style.

Actually I am new to functional or declarative programming (I just was studying some about them). Is it a good advice for students to think decoratively (think to relate the definitions rather how) when they want to write a recursive algorithm? Could it be a general rule for any recursive algorithm?

Ahmad
  • 1.9k
  • 3
  • 21
  • 36