Big O Notation Series #9: Understanding Merge Sort
Understanding Merge Sort: Deep dive into merge sort, recursion, and its time complexity.
Chapters:
00:00 Intro
01:13 Recursion
08:00 Merge
11:51 Time Complexity: O(n log n)
More from this series: • Big O For Software Eng...
merge sort divide and conquer recursive merge sort merge sort algorithm sorting algorithm merge sort code sorting algorithms merge sort animation sorting algorithms visualized sorting algorithms explained merge sort algorithm javascript merge sort algorithm explained merge sort algorithm analysis merge sort algorithm time complexity big o series big o mini series big o notation series big o notation mini series understanding merge sort Join the Discord to talk to me and the rest of the community!
/ discord
Пікірлер: 32
Wonderfully explained!!!Thank you for elucidating so much on time complexities. Best video I have even seen on YT regarding Time complexities.
@kantancoding
2 жыл бұрын
Your comment makes me smile 🙂 Thank you 💙
Thank you. Just...thank you. I'm a frontend dev and I've always considered this stuff way over my head, but it's slowly starting to make sense.
@kantancoding
2 жыл бұрын
That’s great! Things always seem more complicated than they are in the beginning. Keep it up!
Really helpful and clear thank you so much... 2 min to understand the time complexity is amazing!!!
@kantancoding
2 жыл бұрын
That’s great news. I’m glad it helped you!
This helps me a lot. Thank you so much!! Love you!❤
@kantancoding
Жыл бұрын
Happy to help! ❤️
As usual you are exceptional ✨!
@kantancoding
3 жыл бұрын
Thank you! 🥲
Good explanation, thank you!
@kantancoding
3 жыл бұрын
Thank you! I’m glad it was helpful😆
THANK YOU
@kantancoding
Жыл бұрын
Happy to help! 😊
But when we talk about the time complexity of a recursive program, let's say finding fibonacci series, we take into account the number of times a single function calls itself recursively but here we're doing it in a different way. I am a bit confused as to if we apply the same procedure to the fibonacci algo, how would we find the time complexity.
@kantancoding
10 ай бұрын
There’s a video in this series that explains Fibonacci time & space complexity
Great video! Btw what is the note taking app/setup you are using on your iPad to explain the conceptual part of this video?
@kantancoding
2 жыл бұрын
I think it's called goodnotes but I will have to check later
Thank you for this. I was wondering what programs and software you use to write and record your desktop?
@kantancoding
2 жыл бұрын
You’re welcome, I’m just using the screen recorder that comes included on my MacBook
you're great. thank you
@kantancoding
2 жыл бұрын
Thank you 🙏 🙂
Thanks! do you have any video on the Quicksort?
@kantancoding
3 жыл бұрын
Not yet, but I’ll add it and the other sorting algorithms to my backlog 🙏
Something that has been bugging me about merge sort is it classifies the operations of dividing as O(1). However the slice operations create new arrays every time which is technically (n / 2) yet it isn't included in the analysis. Why is this considered constant time?
@kantancoding
Жыл бұрын
Good point. It actually depends on the implementation. You can make the splitting of the array O(1) by not actually splitting the array but instead just using the same array and keeping track of where you are in the array by just using the array’s indexes. That is the more optimized way to do it. But even if you consider that we are making copies of the array at every level, and also need to touch every element to compare values, it is still O(n log n) because O(2n * log n) simplifies to O(n log n)
Why are we considering level of operations instead of number of operations... It seems that time complexity has to be O(n.2^n) right. Like if we compare this tree architecture with the previous video, O(2^n) complexity looks more relevant than O(log n). Please correct me if I am wrong.
@kantancoding
2 жыл бұрын
The tree will be comprised of log base 2 of n levels. At each level we need to touch every element of n. So the time complexity is number of levels times n. So O(number of levels * n). number of levels = log n, so time complexity is O(log n * n) or O(n * log n) or O(n log n). Does that help?
@gitgyan5202
2 жыл бұрын
Got it. Thankyou very much 👏
4:10... time to eat something =P
@kantancoding
2 жыл бұрын
🤣
1 min wasted for opening a box