LeetCode Range Sum of BST Explained - Java

  Рет қаралды 16,787

Nick White

Nick White

Күн бұрын

Пікірлер: 12
@milad950
@milad950 5 жыл бұрын
That was super helpful. Thank you very much Nick!
@pubamx
@pubamx 4 жыл бұрын
What about Time & Space complexity and which solution (iteratively && recursive) could be better?
@codemonkey2614
@codemonkey2614 3 жыл бұрын
I guess recursive time complexity should be Big O of N (the total number of nodes) under the worse case in which L equals the smallest node and R equals the biggest node in BST.
@Randomguu
@Randomguu 3 жыл бұрын
couple of points recursive is always worse, the java virtual machine needs to maintain the recursive stack pointers so thats more space and they are located randomly within your ram so it cannot be easily cached by cpu so time is also worse, also we never take advantage of the binary nature of the tree, I would go for binary search to find first element bigger than L and then do in order traversal on its right subtree until wwe reach > R then stop. Think thats the most optimal approach
@snowyalbino130
@snowyalbino130 5 жыл бұрын
Great stuff mate, thanks!
@NickWhite
@NickWhite 5 жыл бұрын
Thanks for watching dude!
@atharvakulkarni2024
@atharvakulkarni2024 3 жыл бұрын
this iterative approach is giving tle in cpp
@MrThepratik
@MrThepratik 5 жыл бұрын
nice one nick
@optussport337
@optussport337 4 жыл бұрын
How was the Organic Chemistry Class? XD
@harryz7973
@harryz7973 3 жыл бұрын
good job Nick
@jinhuacao253
@jinhuacao253 5 жыл бұрын
thanks nick
@avinashpatil5572
@avinashpatil5572 7 ай бұрын
Done
LeetCode Check Completeness of a Binary Tree Explained - Java
6:35
Range Sum of BST
8:39
Kevin Naughton Jr.
Рет қаралды 30 М.
FOREVER BUNNY
00:14
Natan por Aí
Рет қаралды 36 МЛН
А я думаю что за звук такой знакомый? 😂😂😂
00:15
Денис Кукояка
Рет қаралды 6 МЛН
I Got Rejected (again)
9:43
Nick White
Рет қаралды 205 М.
Top 7 Algorithms for Coding Interviews Explained SIMPLY
21:22
Codebagel
Рет қаралды 447 М.
Making an Algorithm Faster
30:08
NeetCodeIO
Рет қаралды 159 М.
LeetCode was HARD until I Learned these 15 Patterns
13:00
Ashish Pratap Singh
Рет қаралды 599 М.
Self Taught Programmers... Listen Up.
11:21
Nick White
Рет қаралды 1,1 МЛН
RANGE SUM OF A BST | PYTHON SOLUTION | LEETCODE 938
10:16
Cracking FAANG
Рет қаралды 2,9 М.
Coding Was Hard Until I Learned THESE 5 Things!
8:02
Nick White
Рет қаралды 33 М.
L14. Maximum Depth in Binary Tree | Height of Binary Tree | C++ | Java
8:05