filmov
tv
Memo Tables and the Magic of Higher Order Functions in Python!

Показать описание
Higher order functions are functions that take in and/or return other functions, and we're going to use this incredibly powerful feature to implement memoization. Memoization is an incredible technique that can significantly speed up naively-implemented recursive functions,, with little additional knowledge required.
Today, we explore a Python technique to easily "inject" memoization capability to ANY function, allowing great speedups with no changes to the function itself!
= TABLE OF CONTENTS =
0:00 Introduction & Context
1:01 Video Contents Page
2:05 Background: Naive Recursive Functions
2:55 Code: Fibonacci Function
4:22 Code: Seeing the slowness of Recursive Fibonacci
5:59 Theory: Higher Order Functions in Python
7:03 Theory: Our Strategy to "Inject" Code into a Function
7:53 Background: Applying Higher Order Functions with Counting
8:17 Code: Applying Higher Order Functions with a Counting
11:18 Code: Using our count() function
13:22 Background: The big problem
13:54 Theory: What is Memoization
15:52 Code: Creating the memoize() higher order function
19:14 Code: Running our memoize() function
20:10 Code: Using count() and memoize() together
22:08 Code: Visualizing the Memo Table
22:53 Theory: Generalizing to larger functions (Multiple Parameters)
24:29 Code: The nCr() Function (Two Parameters)
25:24 Code: Applying count() and memoize() to nCr()
26:30 Code: Visualizing the Memo Table
27:31 Summary
= CODE DOWNLOAD =
To download, first click on "Downloads" in the left sidebar. Then, in the subsequent page, click "Download Repository".
= 0612 TV =
Enjoy your stay, and don't hesitate to drop me a comment or a personal message to my inbox =) If you like my work, don't forget to subscribe!
= NERDfirst =
NERDfirst is a project allowing me to go above and beyond YouTube videos into areas like app and game development. It will also contain the official 0612 TV blog and other resources.
-----
Disclaimer: Please note that any information is provided on this channel in good faith, but I cannot guarantee 100% accuracy / correctness on all content. Contributors to this channel are not to be held responsible for any possible outcomes from your use of the information.
Today, we explore a Python technique to easily "inject" memoization capability to ANY function, allowing great speedups with no changes to the function itself!
= TABLE OF CONTENTS =
0:00 Introduction & Context
1:01 Video Contents Page
2:05 Background: Naive Recursive Functions
2:55 Code: Fibonacci Function
4:22 Code: Seeing the slowness of Recursive Fibonacci
5:59 Theory: Higher Order Functions in Python
7:03 Theory: Our Strategy to "Inject" Code into a Function
7:53 Background: Applying Higher Order Functions with Counting
8:17 Code: Applying Higher Order Functions with a Counting
11:18 Code: Using our count() function
13:22 Background: The big problem
13:54 Theory: What is Memoization
15:52 Code: Creating the memoize() higher order function
19:14 Code: Running our memoize() function
20:10 Code: Using count() and memoize() together
22:08 Code: Visualizing the Memo Table
22:53 Theory: Generalizing to larger functions (Multiple Parameters)
24:29 Code: The nCr() Function (Two Parameters)
25:24 Code: Applying count() and memoize() to nCr()
26:30 Code: Visualizing the Memo Table
27:31 Summary
= CODE DOWNLOAD =
To download, first click on "Downloads" in the left sidebar. Then, in the subsequent page, click "Download Repository".
= 0612 TV =
Enjoy your stay, and don't hesitate to drop me a comment or a personal message to my inbox =) If you like my work, don't forget to subscribe!
= NERDfirst =
NERDfirst is a project allowing me to go above and beyond YouTube videos into areas like app and game development. It will also contain the official 0612 TV blog and other resources.
-----
Disclaimer: Please note that any information is provided on this channel in good faith, but I cannot guarantee 100% accuracy / correctness on all content. Contributors to this channel are not to be held responsible for any possible outcomes from your use of the information.
Комментарии