Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • If language does not support Tail Call Optimization then yes - recursion takes up stack memory. But we have TCO around since 1977, so it should not be a problem. Commented Nov 24, 2019 at 19:34
  • You don’t need tail recursion for Quicksort. Stack usage = 2 log n integers. Commented Nov 25, 2019 at 11:14
  • @rsm It's not that easy. TCO isn't possible when there is memory to be cleaned up at the end of a function call, when reference counting is used (std::shared_ptr in C++, Rc/Arc in Rust, references in Swift and Python, etc.) Commented Nov 26, 2019 at 20:46