filmov
tv
Recursion - Javascript In Depth
Показать описание
We take a look at recursion and how we can implement it in Javascript together. Recursion allows us to call the function we are in from within itself and setup cases where we can break out of the "recursive loop". We see some cases where we need recursion to solve certain types of problems that would be a struggle with constructs like loops or functions.
We go through a few "simpler" examples followed by a more complex but realistic example of recursion over a tree-like data structure (a gold mine). We use this to walk through different mine configurations and trace the code line by line to see what is happening inside the recursive loop.
Note that this is an advanced topic and will take a lot of practice and trying different things over time to really cement. We'll go through some practice exercises together on recursion in the next video in the series.
Chapters:
00:00 Introduction
02:18 Why Recursion?
05:55 Functions in Functions?
08:48 Intro Recursion Code Example
15:14 Recursion Array Example
27:16 Recursion Return Visuals
29:25 Recursion Gold Mine Adventure - Trees
31:06 Gold Mine Level Design and Goals
32:36 Gold Mine 4 Level Layouts
34:09 Possible Mine Layouts
37:25 Walkthrough 1 Level
38:21 Walkthrough 2 Levels (One side)
41:34 Walkthrough 2 Levels (Both sides)
43:55 Practice Example 3 Levels
44:05 Possible Algorithm
47:20 Coding the Gold Mind Recursion
57:05 Code Walkthrough
1:02:21 Advice to Learn and Practice
1:05:51 Next Steps
We go through a few "simpler" examples followed by a more complex but realistic example of recursion over a tree-like data structure (a gold mine). We use this to walk through different mine configurations and trace the code line by line to see what is happening inside the recursive loop.
Note that this is an advanced topic and will take a lot of practice and trying different things over time to really cement. We'll go through some practice exercises together on recursion in the next video in the series.
Chapters:
00:00 Introduction
02:18 Why Recursion?
05:55 Functions in Functions?
08:48 Intro Recursion Code Example
15:14 Recursion Array Example
27:16 Recursion Return Visuals
29:25 Recursion Gold Mine Adventure - Trees
31:06 Gold Mine Level Design and Goals
32:36 Gold Mine 4 Level Layouts
34:09 Possible Mine Layouts
37:25 Walkthrough 1 Level
38:21 Walkthrough 2 Levels (One side)
41:34 Walkthrough 2 Levels (Both sides)
43:55 Practice Example 3 Levels
44:05 Possible Algorithm
47:20 Coding the Gold Mind Recursion
57:05 Code Walkthrough
1:02:21 Advice to Learn and Practice
1:05:51 Next Steps
Комментарии