Skip to content

Introduction to recursion and visualizing function calls being placed on the call stack using breakpoints.

Notifications You must be signed in to change notification settings

alexpaul/Recursion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Recursion

Recursion: in computer science and Swift this is the process whereby a function calls itself. A recursive function must have a base case and the recursive call.

func countDownToSwiftVersion1(_ n: Int) {
  guard n > 0 else { return } // base case
  print("Swift Version \(n)")
  countDownToSwiftVersion1(n - 1) // recursive call
}
countDownToSwiftVersion1(5)

/*
 Swift Version 5
 Swift Version 4
 Swift Version 3
 Swift Version 2
 Swift Version 1
*/

Introduction to recursion and visualizing function calls being placed on the call stack using breakpoints.

Recursion is introduced using a single view application and showing how each recursive call is placed on the call stack.

ViewController

The playground file is used to illustration the benefits of dynamic programming (memoization and recursion)

Playground

About

Introduction to recursion and visualizing function calls being placed on the call stack using breakpoints.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages