0

Are some algorithms inherently recursive? As in, rewriting it in tail-recursive/iterative form with a stack is still needed, and there is no way to do it otherwise.

I am asking because I struggled to implement the function stringsMatchingPrefix on a Trie tail-recursively without a stack. The stringsMatchingPrefix problem is: given a string P, find all the words in the trie with the prefix P.

Caleb Stanford
  • 7,298
  • 2
  • 29
  • 50
blitzqwe
  • 125
  • 2

0 Answers0