Count Complete Tree Nodes (LeetCode 222) | Complete tree examples | Recursive & Iterative

  Рет қаралды 2,349

Nikhil Lohia

Nikhil Lohia

Күн бұрын

Join this channel to get access to perks: / @nikoo28
Actual problem on LeetCode: leetcode.com/problems/count-c...
Chapters:
00:00 - Intro
00:47 - Problem Statement
01:40 - Examples of a Complete Binary Tree
06:02 - Iterative Level Order Traversal
07:00 - Recursive Version (Dry-run of Code)
13:38 - Final Thoughts
📚 Links to topics I talk about in the video:
Recursion: • Recursion paradigms wi...
Binary Tree: • Binary Trees Introduct...
Tree Data Structure: • Understanding Tree Dat...
Level Order Traversal: • Level order traversal ...
Playlist on Trees: • Trees
📘 A text based explanation is available at: studyalgorithms.com
Code on Github: github.com/nikoo28/java-solut...
Test-cases on Github: github.com/nikoo28/java-solut...
📖 Reference Books:
Starting Learn to Code: amzn.to/3sJm8Wl
Favorite book to understand algorithms: amzn.to/4848xJH
Favorite book for data structures: amzn.to/3P96YBv
Get started for interview preparation: amzn.to/44Nn5du
🔗 To see more videos like this, you can show your support on: www.buymeacoffee.com/studyalg...
🎥 My Recording Gear:
Recording Light: amzn.to/3PdsViT
Microphone: amzn.to/3Exv83x
Recording Camera: amzn.to/3PwyN8e
Tablet to sketch and draw: amzn.to/3ZdKVy7
Sketching Tool: amzn.to/45XJEgY
Laptop to edit videos: amzn.to/460ofDu
💻 Get Social 💻
Follow on Facebook at: / studyalgos
Subscribe to RSS feeds: studyalgorithms.com/feed/
Join fan mail: eepurl.com/g9Dadv
#leetcode #programming #interview

Пікірлер: 16
@vipulaggarwal8518
@vipulaggarwal8518 2 ай бұрын
your voice is so pleasant to our ears and your way to explain the approach and code is absolutely fantastic. Thanks for the content you gave us !😊😇
@navyanavilu2639
@navyanavilu2639 Ай бұрын
Well explained. Thank you!
@jagicyooo2007
@jagicyooo2007 5 ай бұрын
so concise!
@user-um3vb7eu4k
@user-um3vb7eu4k 5 ай бұрын
Nice explanation sir ❤❤
@udayrajvadeghar8555
@udayrajvadeghar8555 5 ай бұрын
Fire content :)
@luminraja09
@luminraja09 2 ай бұрын
So 1 is for the root node of the subTree / main tree ?
@sunilkumawat7959
@sunilkumawat7959 Ай бұрын
By looking at your code : T(n) = 2 T(n/2) + k, It gives nlog(n) time complexity. Please correct me if I am wrong
@jritzeku
@jritzeku 3 ай бұрын
Is there a way to add own test cases and see expected output on Leetcode? I feel like this would be helpful feature because the examples provided generally cover few edge cases only. I think I've seen some one create test case tree via comments and the run test for that. ex: check if following is valid BST, resulting in false /* 1 / \ 2 3 */
@nikoo28
@nikoo28 3 ай бұрын
if you click the 'Console' window on leetcode, it allows you to pass custom test cases
@tanishkaagarwal6750
@tanishkaagarwal6750 5 ай бұрын
sir, please make a solution video on Next Permutation problem . Leetcode 31
@mhmd5ld81
@mhmd5ld81 5 ай бұрын
Tbh that question chases me in my dreams XD
@nikoo28
@nikoo28 4 ай бұрын
sure, I will add it to my pipeline of videos.
@khushaldodeja8267
@khushaldodeja8267 4 ай бұрын
Is there anyone facing issue imagining how recursion works?
@khushaldodeja8267
@khushaldodeja8267 4 ай бұрын
could you dry run this question
@nikoo28
@nikoo28 4 ай бұрын
I will do a video on dry running a recursive problem.
@solzerid
@solzerid 3 ай бұрын
This is one of the hurdles that make a huge difference in your ability to solve problems. Take some time to focus on recursion. Look at various simpler recursive problems until you can start to see patterns and visualize how it works. Once you can visualize recursion it will be a quantum leap forward in your programming skills. There are a lot of milestones like this, just try not to get discouraged and keep finding material on the subject until it clicks. You'll eventually have enough practice or find the perfect lesson for you that will make it 'click'.
Smart Sigma Kid #funny #sigma #memes
00:26
CRAZY GREAPA
Рет қаралды 12 МЛН
Count Complete Tree Nodes | Leetcode #222
13:39
Techdose
Рет қаралды 32 М.
Leetcode - The Path to Enlightenment
3:11
NeetCodeIO
Рет қаралды 151 М.
Stop, Intel’s Already Dead! - AMD Ryzen 9600X & 9700X Review
13:47
Linus Tech Tips
Рет қаралды 1,2 МЛН
25 Nooby Pandas Coding Mistakes You Should NEVER make.
11:30
Rob Mulla
Рет қаралды 265 М.
Top 7 Algorithms for Coding Interviews Explained SIMPLY
21:22
Codebagel
Рет қаралды 344 М.