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

  • @priyadarshinivenkatesan9111
    @priyadarshinivenkatesan91112 жыл бұрын

    Wonderfully explained!!!Thank you for elucidating so much on time complexities. Best video I have even seen on YT regarding Time complexities.

  • @kantancoding

    @kantancoding

    2 жыл бұрын

    Your comment makes me smile 🙂 Thank you 💙

  • @sarahelizabeth1279
    @sarahelizabeth12792 жыл бұрын

    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

    @kantancoding

    2 жыл бұрын

    That’s great! Things always seem more complicated than they are in the beginning. Keep it up!

  • @samabdallah2659
    @samabdallah26592 жыл бұрын

    Really helpful and clear thank you so much... 2 min to understand the time complexity is amazing!!!

  • @kantancoding

    @kantancoding

    2 жыл бұрын

    That’s great news. I’m glad it helped you!

  • @ratoohhatar760
    @ratoohhatar760 Жыл бұрын

    This helps me a lot. Thank you so much!! Love you!❤

  • @kantancoding

    @kantancoding

    Жыл бұрын

    Happy to help! ❤️

  • @rutujabhurse3291
    @rutujabhurse32913 жыл бұрын

    As usual you are exceptional ✨!

  • @kantancoding

    @kantancoding

    3 жыл бұрын

    Thank you! 🥲

  • @ravasconcelos1
    @ravasconcelos13 жыл бұрын

    Good explanation, thank you!

  • @kantancoding

    @kantancoding

    3 жыл бұрын

    Thank you! I’m glad it was helpful😆

  • @gabrielesimoncini1121
    @gabrielesimoncini1121 Жыл бұрын

    THANK YOU

  • @kantancoding

    @kantancoding

    Жыл бұрын

    Happy to help! 😊

  • @syedfaheem1185
    @syedfaheem118510 ай бұрын

    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

    @kantancoding

    10 ай бұрын

    There’s a video in this series that explains Fibonacci time & space complexity

  • @jubaer.hossain
    @jubaer.hossain2 жыл бұрын

    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

    @kantancoding

    2 жыл бұрын

    I think it's called goodnotes but I will have to check later

  • @boshhy
    @boshhy2 жыл бұрын

    Thank you for this. I was wondering what programs and software you use to write and record your desktop?

  • @kantancoding

    @kantancoding

    2 жыл бұрын

    You’re welcome, I’m just using the screen recorder that comes included on my MacBook

  • @aat501
    @aat5012 жыл бұрын

    you're great. thank you

  • @kantancoding

    @kantancoding

    2 жыл бұрын

    Thank you 🙏 🙂

  • @taiguntales
    @taiguntales3 жыл бұрын

    Thanks! do you have any video on the Quicksort?

  • @kantancoding

    @kantancoding

    3 жыл бұрын

    Not yet, but I’ll add it and the other sorting algorithms to my backlog 🙏

  • @kaos092
    @kaos092 Жыл бұрын

    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

    @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)

  • @gitgyan5202
    @gitgyan52022 жыл бұрын

    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

    @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

    @gitgyan5202

    2 жыл бұрын

    Got it. Thankyou very much 👏

  • @douglas_dev1
    @douglas_dev12 жыл бұрын

    4:10... time to eat something =P

  • @kantancoding

    @kantancoding

    2 жыл бұрын

    🤣

  • @Apprenticer
    @Apprenticer2 жыл бұрын

    1 min wasted for opening a box