Your videos are wonderful! Please keep providing new content - your explanations are incredibly easy to understand~
@realmusagabriel2 жыл бұрын
especially the visualization! easy to understand
@DennisPing3 жыл бұрын
I appreciate the multiple examples in this video. Thanks.
@Eddie4k Жыл бұрын
For the sum recursion problem, I implemented it using .pop() instead of slicing. def sum(arr): if len(arr) == 0: return 0 return arr.pop() + sum(arr)
@JT-iw2cw3 жыл бұрын
I initially thought your approach was abstract and confusing, but on further thought it's enlightens how the recursion executes. Perhaps that's why we struggle with recursion in the first place, we look to the output rather than look at the steps to get there.
@azizbenanaya88334 жыл бұрын
thank you so much this is wonderful , but could you please organize the videos so that we can follow the right order and thanks again for your great effort .
@yevheniiganusich50173 жыл бұрын
I don't know why this channel doesn't have more subscribers!!!
@sgsniper13 жыл бұрын
Hi Alvin, one question, isn't the space complexity O(n^2) too? cuz it creates a new subarray in each call stack of n recursive calls, so it's n*n memory space overall.
@xingyanglan68363 жыл бұрын
no, it depends on if the recursion is “preorder” or “inorder” or “postorder” etc traversal. The temporary variables are all cleared if its the recursion occurs preorder which it often is with arrays, meaning the big-O space complexity could be as low as linear; such occurs as a limitation of a computer to only have one turing-esque pointer, but is not a factor in actual multicore computing i think
@Hello-jz3em2 жыл бұрын
If we think about what Alvin wrote here, simply each stack call consumes O(n) space so it should be O(N^2).
@Dipenparmar122 жыл бұрын
I love the way of explaining.
@chrisjarvis5093 жыл бұрын
Really great videos!!! Thank you
@deyvidpopov27782 жыл бұрын
You can set a default value to the *idx* and skip passing the 0 by the first call of *_sum* function.
@qwertyguy15563 жыл бұрын
wow your videos are super amazing! Tnx I really needed them
@souravskr2 жыл бұрын
Linear Time Solution def sum_array(nums): size = len(nums) if not size: return 0 print(nums) num = nums.pop(size - 1) time.sleep(2) return num + sum_array(nums)
@TheJakehalsted Жыл бұрын
divide into two halfs...divive each half into two halfs....its log2(N) much better than linear time
@MrFsjay3 жыл бұрын
all of your videos are amazing
@burszuras16743 жыл бұрын
Great tutorial however I'm having issues understanding space complexity used here. How is that possible that Space: O(n) in sum algorithm from 09:30. We are doing n recursive calls and each of them keeps local variable 'rest' on the stack (which is roughly of size n). According to my understanding the space complexity should be O(n^2). Am I missing something?
@SLPKNTs3 жыл бұрын
True. Each recursive call will have new array to work with and the size of it will decrease by 1 on each recursive call, meaning the space used by all those arrays is an integral of n, which results into 1/2 * n^2 and simplifies by big-O rules to just n^2
@kirillzlobin7135 Жыл бұрын
Great video
@davidfernandezbajo3 жыл бұрын
I came up with >> return arr.shift() + sum(arr), anything wrong with that?
@ritsk43384 жыл бұрын
First like. Superb Video. Awesome explanation
@CoderbyteDevelopers4 жыл бұрын
Thanks for watching our videos!
@stanleyagwu48183 жыл бұрын
Great work!
@usmanmunir15593 жыл бұрын
Awesome 🤍
@yohannistelila88793 жыл бұрын
Thank you so much!!!
@iiimiiim Жыл бұрын
Thank yoooooou!
@cmdv422 жыл бұрын
💎
@BabekNagiyev3 жыл бұрын
Unsbscribe? I'd rather leave development
@TheJakehalsted Жыл бұрын
Divide and conquer. O Log2(N) Now I'll write it, then I'll watch the video. Then I'll roll me eyes and write in in ARmV8 Assembler just to be a chode
@Eddie4k Жыл бұрын
For the sum recursion problem, I implemented it using .pop() instead of slicing. def sum(arr): if len(arr) == 0: return 0 return arr.pop() + sum(arr)