Logo Mina san coding
Logo Inverted Logo
  • Posts
  • Tech
    • Obsidian sync
  • Computer Science
    • Introduction
    • Algorithms
      • Recursion
    • Basic
      • Call Stack
      • Function Call
    • Data Structure
      • Stack
Hero Image
Recursion

Recursion is the function calling itself. Case Base case: The condition to stop the loop Recursive case: Keep self calling the function function countdown(i){ console.log(i); if (i <= 0) { // Base case return } return countdown(i-1); // Recursive case } Cost Recursion saving the info needs memory, if your recursion have to execute man times, you will need lots of memory. However, it can be solved by Tail Recursion.

June 13, 2020 Read
Navigation
  • About
  • Skills
  • Experiences
  • Education
  • Projects
  • Recent Posts
  • Accomplishments
Contact me:
  • Email: mp922352612@gmail.com

Toha Theme Logo Toha
© 2021 Copyright.
Powered by Hugo Logo