Analysis of Merge sort algorithm

Sdílet
Vložit
  • čas přidán 5. 07. 2013
  • See complete series on sorting algorithms here:
    • Sorting Algorithms
    This is part 2 of our lesson on Merge sort. Merge sort is a divide and conquer algorithm that has worst case time complexity of O(nlogn). In this lesson, we have analyzed the time and space complexity of merge sort algorithm.
    See first part of this lesson here:
    • Merge sort algorithm
    Series on time complexity analysis:
    • Time Complexity Analysis
    For more such videos and updates, subscribe to our channel.
    You may also like us on facebook:
    / mycodeschool

Komentáře • 208

  • @johnhurley8918
    @johnhurley8918 Před 7 lety +197

    I just noticed that when analysing time complexity, he color codes each operation by type:
    Teal = Simple actions
    Red = Loops
    Purple = Recursive calls
    That makes it so much easier to follow!

  • @user-eq4oy6bk5p
    @user-eq4oy6bk5p Před 9 lety +129

    WAYWAYWAYWAY better than my prof's lecture

  • @macgyver985
    @macgyver985 Před 8 lety +18

    Best part, the videos are in the cinematic aspect ratio, so they look awesome on ultra wide monitors!

  • @19.sairoopesh10
    @19.sairoopesh10 Před 2 měsíci +1

    The quality of these videos is amazing. The aspect ratio is perfect, the voice is clear, and I love how they use different colors for functions, recursion, and loops. It's crazy to think that this quality is from almost 10 years ago

  • @abhisheksharmacs
    @abhisheksharmacs Před 8 lety +9

    this is the best that I have seen on Merge sort complexity

  • @7s3em
    @7s3em Před 8 lety +33

    absolutely amazing channel ! you are a GREAT teacher thank's alot keep up the hardwork

  • @marcelluiz96
    @marcelluiz96 Před 10 lety +5

    Thank you so much! I needed to understand mergesort for a college activity, and this was the clearer and best explained method i've found :D

  • @asmereg
    @asmereg Před 3 lety +7

    Wow, his is 2013 video. I'm watching it in 2020 to sit for my campus placements. Great explanation👏💕

  • @calmyourmind5617
    @calmyourmind5617 Před 2 lety +12

    The simple thing is : There will be logn levels to divide the array up to 1. and then for each level merge function is applied which itself takes 0(n) time. Therefore multiply n with the total step taken which is logn. The overall time complexity therefore boils down to 0(nlogn).

    • @PeterXyzdlv
      @PeterXyzdlv Před 9 měsíci

      Array of size 8, how many levels up to 1 ? 4>2>1 which is 3; log 8 base 2 is 3

  • @dillon4321
    @dillon4321 Před 6 lety +1

    Best computer science videos on CZcams. Kudos to you sir

  • @xitiz001
    @xitiz001 Před 8 lety +5

    Presented really well visually & orally. Great Work...!!!

  • @alabimehzabinanisha
    @alabimehzabinanisha Před 9 lety +3

    Thanks a lot for being my Base Case of searching a Merge Sort Tutorial which will provide me details explanation. And of course, better than my Prof's lecture. :)

  • @pralakbhargav7113
    @pralakbhargav7113 Před 9 lety +8

    brilliant teaching!! I wish my Professors could teach like this!

  • @preetsingh239
    @preetsingh239 Před 9 lety +3

    thanks for the awesome lectures ....please upload the rest of the lectures like heap sorting ,etc

  • @justinwmusic
    @justinwmusic Před 5 lety +26

    Translations: "into" = "times" or "multiplied by"; "by" = "divided by"; "upon" = "over" or "divided by"

    • @vinutd210
      @vinutd210 Před 4 lety +6

      Thank you for the cultural translation. :)

    • @ravi090191
      @ravi090191 Před 4 lety +1

      haha. Cool !

  • @ShreyaSingh-vr9qi
    @ShreyaSingh-vr9qi Před 4 lety

    One of the best video explaination of time as well as space complexity !!

  • @sashankaryal1223
    @sashankaryal1223 Před 8 lety +3

    Such a wonderful explanation! Thank you so much.

  • @kelvinluu7228
    @kelvinluu7228 Před 8 lety +1

    this guy is actually a god. perfect way of explaining hard concepts

  • @mycodeschool
    @mycodeschool  Před 11 lety +2

    Yes, We are reducing the expression at each step,, So, K is starting from 1 and increasing till we reach T(1) .. You can either reach me here or write to mycodeschool [AT] gmail [DOT] com

  • @arunrnambiar9561
    @arunrnambiar9561 Před 6 lety +3

    Why the memory consumed in stack not taken into account like in the space complexity analysis of fibonacci, exponential modulation etc

  • @youtubebaba1935
    @youtubebaba1935 Před 9 lety +1

    Hey Man do you know how great work you are doing for others ? people like you makes the world beautiful :)

  • @hovhadovah
    @hovhadovah Před 7 lety +3

    Incredible explanation, thank you so much!

  • @debarshiroy2939
    @debarshiroy2939 Před rokem

    Your videos are so interesting, always forget to like. Thank you Sir for such clear explanation and hope for more videos

  • @mycodeschool
    @mycodeschool  Před 11 lety +3

    Hi Shanmuk,
    What is it that you do not understand? I can try explaining. Well, maths and programming go together. But, you don't always do such complex calculations to figure out time complexity. Recursion is tricky. I am sure you know enough maths to be able to program, that's why you are here. If you are not getting anything in this tutorial, ask specific questions.

    • @senthilrajanr1
      @senthilrajanr1 Před 5 lety +2

      I am having a hard time to follow the time complexity calculation. Maybe I don't know logarithmic and could be the reason. how come T(n/2) would become 2T(n/4)+c'(n/2). where does the c' come from? and i do not understand how 2^log2n T(1) will become nc. maybe it's just me but I could not follow. But thanks for doing this work. Appreciate it. If possible please try to do another video.Thanks

  • @harshitanag2452
    @harshitanag2452 Před 3 lety

    Best explanation I found on youtube till date :)

  • @elmehdifetouaki2641
    @elmehdifetouaki2641 Před 7 měsíci

    A fascinating explanation as expected, just as a remark, we could use master theorem and get the complexity easily

  • @simonetruglia
    @simonetruglia Před 10 lety +1

    This is better explenation about it than I never said, thanks a lot :)

  • @gajendragulgulia9889
    @gajendragulgulia9889 Před 7 lety +4

    hey.. thanks for the great work. Will be good to have videos for Bucket Sort, Radix Sort and Searching Problems (Sequential Search, Binary Search etc)

  • @selenewaide8994
    @selenewaide8994 Před 7 lety +1

    Great video, thank you for your clear explanation.

  • @ManojSaini_15
    @ManojSaini_15 Před 9 lety

    Awesome explaination..i was just looking for an easy explaination..and you ended my search..;-)

  • @jossba1628
    @jossba1628 Před 6 lety +1

    thank you for your help! I really enjoy watching your videos :)

  • @ashuprakash6266
    @ashuprakash6266 Před 9 lety +2

    I guess the Big-O notation is more famous !
    Big O gives the worst case scenario that is the tightest upper bound.
    While Theta notation is for function bounded between two curves from down and above.

  • @azukib2230
    @azukib2230 Před 3 lety

    Thank you! I needed a video to explain the formulas

  • @bc8409
    @bc8409 Před 5 lety +2

    thanks for giving us this. super helpful and clear. gj

  • @usama57926
    @usama57926 Před 6 lety +4

    bro you are an great mathematician

  • @anuragreddy391
    @anuragreddy391 Před 10 lety

    Could you tell me the time complexity bcoz i am getting 0(n2) because comparing and moving is present

  • @6304abhishek
    @6304abhishek Před 6 lety +4

    liked the space complexity explanation :)

  • @ajayrajan8882
    @ajayrajan8882 Před 5 lety +36

    My respects for #HumbleFool

    • @AyushGupta-mm4jg
      @AyushGupta-mm4jg Před 3 lety +1

      He is not humblefool . He is animesh nayan

    • @RAHUL-gf3ft
      @RAHUL-gf3ft Před 3 lety

      @@AyushGupta-mm4jg he is Harsha Suryanarayana from IIIT Allahabad
      #humblefool

    • @nileshgopale8528
      @nileshgopale8528 Před 3 lety +2

      @@RAHUL-gf3ft he is Animesh Nayan , if you want to hear to audio of Harsha Suryanarayana , then access the Euclid's GCD Algorithm on mycodeschool.

    • @navyasri5077
      @navyasri5077 Před 2 lety

      @@RAHUL-gf3ft this iiitA people just💥🦸‍♀

    • @RAHUL-gf3ft
      @RAHUL-gf3ft Před 2 lety

      @@navyasri5077 Proud to be an IIITian

  • @vishalm4074
    @vishalm4074 Před 8 lety

    Can you give a link to logarithmic laws required to solve recursions ?

  • @RECOMMENDED_ACC_IMA
    @RECOMMENDED_ACC_IMA Před 5 lety

    Great way of explanation...loved it❤❤❤

  • @saurabhvemuri
    @saurabhvemuri Před 9 lety +8

    SIR PLEASE UPLOAD VIDEOS ON HASHTABLES

  • @harshitasharma9061
    @harshitasharma9061 Před 7 lety +1

    Wow!!!! Awesome explanation. Didn't knew about theta complexity. Everywhere I saw it was big Oh only. And many do not bother about space complexity. Thanks a lot. Please upload videos on heap sort also. Also sir if you could do some difficult time complexity questions on sorting algorithms, it will be very helpful for entrance exams (GATE etc.) Thank you sir!

    • @shashanksahu1971
      @shashanksahu1971 Před 5 lety

      This great programmer is not between us.
      fossiiita.github.io/humblefoolcup/humblefool/humblefool.html

  • @bingqingwang850
    @bingqingwang850 Před 5 lety

    far more better than my teacher's lecture!

  • @CSshreyas
    @CSshreyas Před 9 lety

    excellent explanation, thanks for the video

  • @pravakarpatel3909
    @pravakarpatel3909 Před 10 lety

    Thanks for g8 explanation sir i got clear picture today on sorting .But i am confused when u said to clear extra memory but as these array is store in the static section it is deleted itself .sir Are u taking in case if it is store in heap section?

  • @manishsen195
    @manishsen195 Před 10 lety +2

    Thanks a lot :) It is really helpful

  • @AbhimanyuAryan
    @AbhimanyuAryan Před 10 lety +1

    mycodeschool at 9:13 are you using plug & chug method?

  • @study-me1oe
    @study-me1oe Před měsícem

    At 16:38, I think at level 1 it is n/2 (not n) because we are using only n/2 space, we didn't even entered the right recursion tree. Same goes for the next level, n/4, then n/8 and so on. So, the total space would be n/2+n/4+n/8+.....+1 (or may use infinity for simplification), and not n+n/2+n/4+....+1. But, anyway, it would be in O(n).
    Correct me if I'm wrong.

  • @saidarahaasayyangalam3445

    I would have porbably joined for a course if you had provided..... No body can ever get these basics in such an interactive way you're providing us with...

  • @krishan7630
    @krishan7630 Před 10 měsíci

    Still You are the best Bro....Just watch your videos to revise topics :)

  • @piyalsana1252
    @piyalsana1252 Před 2 lety

    what to return on the base case of mergesort function?

  • @taiebxr
    @taiebxr Před rokem

    Here for space complexity and absolutely worth it alhamdulilah

  • @pratyushdas8267
    @pratyushdas8267 Před 4 lety

    At 6:56 why is the complexity of Merge() C3.n + C4? Why is it not C3.n?

  • @parthiban_k
    @parthiban_k Před 4 lety

    how to calculate the time complexity of creating left array and right-array

  • @akhilsuresh2560
    @akhilsuresh2560 Před 8 lety +9

    TH BEST EXPLANATION ONE COULD EVER GET.. :) HaTS oFf

  • @tarunkr.9041
    @tarunkr.9041 Před 5 lety

    PEOPLE WHO SO EVER HAVE DISLIKED YOUR VIDEO MUST BE UNIVERSITY PROFESSORS BCZ THEY MUST BE JEALOUS WITH YOUR TEACHING EFFICIENCY.

  • @littleko93
    @littleko93 Před 10 lety

    Great videos, thank you so much

  • @satyakibose8402
    @satyakibose8402 Před 6 lety +4

    Why is n/2^k = 1 at 9:29?
    And also, why at 10:06, 2^log2n = n?

    • @panigrahisnehashish
      @panigrahisnehashish Před 6 lety +3

      We can't determine T(n/2^k). But we need to get rid of T(n/2^k), and we know the T(1) = 1. Hence, we replaced with T(1). How T(1) is 1? Think up of a merge sort having 1 element will sorted in 1 unit of time. And, answering to your second question, log of n base 2 returns "x the POWER of 2 which equals to n". We are powering with the same number i.e. x (the POWER of 2) again, we'll get n. Try with some examples, you'll get it. ex: Base is 2. n = 8. Evaluation: 2 ^ log 8 = 2 ^ 3 = 8.

  • @zingzingzingbahh
    @zingzingzingbahh Před 10 lety +1

    Thanks! this is perfect

  • @jawadanwar6684
    @jawadanwar6684 Před 4 lety

    You are the best, man

  • @katarisaketh7222
    @katarisaketh7222 Před 8 lety +3

    Thanks a lot man!

  • @shashikantyadav4488
    @shashikantyadav4488 Před 8 lety +1

    nice video thanks very much.. its really helpfull

  • @nopecharon
    @nopecharon Před 2 lety

    5:47 I don't understand. It should be n/2 right?

  • @priyathammanu4741
    @priyathammanu4741 Před 9 lety

    wat is the need to again calculate the time complexity ?

  • @ManojSaini_15
    @ManojSaini_15 Před 9 lety +7

    just had a small doubt if someone can explain (may be a dumb one..:/ ) When calculating T(n) array is divided into 2 parts so the k is incremented in every step. But I am confused with the calculation. How 2T becomes 4T and cn becomes 2cn.

    • @rehmanarshad1848
      @rehmanarshad1848 Před 5 lety

      It's done recursively, basically just keep plugging in T(n/2) -> T(n).

  • @prasenjeetbiswal5275
    @prasenjeetbiswal5275 Před 7 lety

    Hi, should not the space complexity be O(nlogn) ? When the left half is completely decomposed, it occupies "(n/2)*logn" space (logn steps) and the right half takes n/2 space. So total space is n/2*logn + n/2 which is equal to nlogn space.

    • @PeterXyzdlv
      @PeterXyzdlv Před 9 měsíci

      How ? Extra space required is just n; left subarray plus right subarray

  • @nooraalmarraj57
    @nooraalmarraj57 Před 10 lety

    thank you thank you thank you so much you are a life saver !

  • @apotessar88
    @apotessar88 Před 8 lety +6

    Sorry, I don't understand when calculating T(n) in 08:52 why T(n) = 2*T(n/2)+c'*n = 2{ 2*T(n/4)+c'*n/2 } + c'*n. Why we need to add c'*n in the end? and it also add c'*n in the following steps afterwards.

    • @sandrok14
      @sandrok14 Před 8 lety +3

      +apo tessar Because it is recursive function. So for example on 8:52, on the second black stroke he has 4*T(n/4) from this he looked what was exactly T(n/4) equal to, so by the same formula he gets 2T(n/2/2) + cn, when plugs in n/2 to general formula. It is same as 2T(n/4) + cn. than he multiplyed by outer 2 which was there before and got 4T(n/4) + cn. The second cn comes from the same function for n/4 written recursively and other cn stays there as before so at last he added them and got 2cn. this get done K times so recursivley he gets kn. Maybe its bad explanation but its hard to explain by words ))

    • @hangchen6131
      @hangchen6131 Před 6 lety

      I still cannot understand it... like, if we expand 2{ 2*T(n/4)+c'*n/2 } + c'*n, it would be
      2{T(n/2) + c'*n/2 } + c'*n =
      2*T(n/2) + c'*n + c'*n =
      2*T(n/2) + 2c'*n
      compared to original
      2*T(n/2)+c'*n
      There seems to be an extra c'*n...
      Why...?

    • @lowzyyy
      @lowzyyy Před 6 lety

      +Hang Chen what are you talking about? When you expand expression of course it wont be the same as original..because you are using T(n/4) to evalute instad of T(n/2)
      He is expanding the whole recursive formula to show you how to get idea of time complexity. Its easier to understand what is going on when u follow original formula..

    • @vamshikrishna8143
      @vamshikrishna8143 Před 6 lety +1

      czcams.com/video/g1AwUYauqgg/video.html

    • @ARWA8400
      @ARWA8400 Před 6 lety

      please can anyone explain to me what is n and from where we get it in O(nlogn) -space complexity "in case we do not clear extra memory" ?

  • @chickenchowman2692
    @chickenchowman2692 Před 5 lety

    Hi, what is n0 in your video?

  • @Tracy_AC
    @Tracy_AC Před 5 lety

    Good explanation.

  • @mohdfirdaus9050
    @mohdfirdaus9050 Před 8 lety +1

    +mycodeschool hi, for the second step, I don't understand how'd you managed to get from c'n to 2c'n. Isn't it supposed to be c'n(1+1/2)?

    • @atareen64
      @atareen64 Před 7 lety +1

      we have to figure out the running time of two recursive calls on n/2 elements. Each of these two recursive calls takes twice of the running time of mergeSort on an (n/4) element subarray (because we have to halve n/2) plus cn/2 to merge, that's where you get the extra factor.

  • @srinjoyghosh1467
    @srinjoyghosh1467 Před 5 lety

    very nice explanation!!!

  • @sunnyjain630
    @sunnyjain630 Před 7 lety

    what a nice way for teaching.. great man!!
    please upload count and radix sort algo
    thanks

    • @shashanksahu1971
      @shashanksahu1971 Před 5 lety

      This great programmer is not between us.fossiiita.github.io/humblefoolcup/humblefool/humblefool.html

    • @mohitvarma1012
      @mohitvarma1012 Před 3 lety +2

      @@shashanksahu1971 the narrator "Animesh Nayan" is alive and working at Google. His friend and co-founder Harsha died in car accident. Most of the videos are done by Animesh.

  • @usama57926
    @usama57926 Před 6 lety +3

    hank for play lists

  • @mkab
    @mkab Před 9 lety

    Thank you so much for this video. I have a question. I usually get confused when calculating the complexity of recursive functions. In this case why is it log n (I know that's the correct answer but why so)?. We have two for loops with complexity of O(n) which is greater than log n. Why don't we derive that the complexity of merge sort is simply O(n). Also since we are going to visit all the nodes in the tree, the complexity should be O(n) right? It'd be very helpful if you can explain this to me.

    • @urvashidang6083
      @urvashidang6083 Před 2 lety

      It will be binary tree with two nodes always and height of binary tree is logn

  • @naganikhilbijjala1000
    @naganikhilbijjala1000 Před 6 lety

    You are really awesome sir

  • @GIULI4994
    @GIULI4994 Před 10 lety +3

    thank you thank you thank you!

  • @kautukraj
    @kautukraj Před 4 lety +1

    Very helpful!

  • @lakshaysharma8144
    @lakshaysharma8144 Před 7 lety +11

    can u plz make a video for greedy algorithms nd dynamic programming

  • @adityachendwankar1068
    @adityachendwankar1068 Před 7 lety

    awesome explanation.........!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • @prabinlamsal5125
    @prabinlamsal5125 Před 2 lety

    thanks for the video.

  • @TightyWhities94
    @TightyWhities94 Před 5 lety +6

    is this information really necessary outside of college?

    • @akashraghav4405
      @akashraghav4405 Před 5 lety +10

      Yes! it is. If you're targeting to work at top organizations. you are expected to know how to analyze your code complexities and optimize if possible.

  • @xc0437
    @xc0437 Před 10 lety +1

    Your videos are so good. Thanks a lot !!

    • @adarozer
      @adarozer Před 2 lety

      Gülsüm hanım nasılsınız? Yedi yıl geçmiş aradan şuan ne iş yapıyorsunuz acaba :d

    • @xc0437
      @xc0437 Před 2 lety +1

      @@adarozer nostalji oldu yorumu görünce :p yazılım firmasında proje yönetimindeyim -.- siz niye düştünüz buralara matematikçilik mi var

    • @adarozer
      @adarozer Před 2 lety

      @@xc0437 Yok ben vize için çalışırken bu videoya bakmıştım öğrenciyim daha bilgisayar mühendisliği okuyorum. İşinizde başarılar.

    • @xc0437
      @xc0437 Před 2 lety

      @@adarozer ne güzel sizin için başarılı okul ve iş hayatı dilerim

  • @bolan167
    @bolan167 Před 6 lety

    You are my hero.

  • @bmprudencio
    @bmprudencio Před 4 lety

    Hello!
    I 'm still stuck in this algorithm. I just can't think of how to do the "merge" method. Does anyone may help me out?

    • @xyzzyx9357
      @xyzzyx9357 Před 4 lety

      There's a video on Merge Sort by Geeksforgeeks, watch it.

  • @sudeepkumar-pd9oq
    @sudeepkumar-pd9oq Před 2 lety +2

    Imagine this great coder with great vision was not died in 2014, this was very unfortunate incidence for every code learner around the world

  • @ShivamKendre-fc3su
    @ShivamKendre-fc3su Před 3 lety

    This person is awesome

  • @sanvadaya
    @sanvadaya Před 7 lety +5

    Can someone explain to me this part
    T(n)=2T(n/2)+C′.n
    T(n)=2{2T(n/4)+C′.n/2}+C′.n
    Why do we multiply by 2 here. And how does C′.n become 2C′.n
    Also what is meant by the constant C here?
    nC+C′.nlogn=θ(nlog n)

    • @ChaminiPrashakthiJayasinghe
      @ChaminiPrashakthiJayasinghe Před 7 lety +11

      + Praveen M
      It is this,
      first you have this equation.
      T(n)=2T(n/2)+C′.n
      so assume n-->n/2
      then substitute n/2 to first equation
      T(n/2)=2T(n/4)+C′.n/2
      then again substitute above equation to the first equation T(n)=2T(n/2)+C′.n
      Hope you got it now. :-)

    • @shreyasabd4974
      @shreyasabd4974 Před 5 lety

      Thank u brother

  • @Bob-uk4bs
    @Bob-uk4bs Před 11 měsíci

    the proof is amazing

  • @dicksonc8470
    @dicksonc8470 Před 6 lety +1

    wait why do we reduce it to T(1)? 9:20

    • @zlaneyronmes
      @zlaneyronmes Před 4 lety

      because in merge sort in worst case we need to divide the array until only 1 element is present in the array.

  • @RohanB90
    @RohanB90 Před 5 lety

    Unfortunately none of the time complexity maths makes any sense to me. Having said that, the algorithm implementation was definitely a great help! Im hoping that just knowing that it is O(nlogn) time complexity if good enough

    • @shahriarmim4696
      @shahriarmim4696 Před 5 lety

      No not always. To be a computer scientist/engineer you have to know deep down of a code.

  • @mangeshrananavare5656
    @mangeshrananavare5656 Před 6 lety

    Brilliant!

  • @munnishaik1292
    @munnishaik1292 Před 10 lety +1

    HI ,
    Nice explanation,
    could you please share the code with us,actually over internet mergesort() taking n parameters buts in ur case its only one and i like that very much.

    • @mycodeschool
      @mycodeschool  Před 10 lety +4

      Munni Saik There is a link in previous video to implementation, But anyway this is the code: gist.github.com/mycodeschool/9678029

  • @alrzhr
    @alrzhr Před 2 lety

    well done

  • @arjundixit5913
    @arjundixit5913 Před 3 lety

    Nice explanation but @ 8:31, why are we having extra C`n outside? the expression inside the curly braces has already balanced the original equation

    • @dee5392
      @dee5392 Před 3 lety

      Because the outside C'n is from the original T(n) equation. The stuff inside the curly braces are the terms from the expansion of T(n/2).

    • @dee5392
      @dee5392 Před 3 lety

      If you look up some info about "recurrence relations", the expansion will make more sense. Hope that helps!

    • @arjundixit5913
      @arjundixit5913 Před 3 lety

      @@dee5392 thanks a lot for the clarification...finally understood 😊

    • @dee5392
      @dee5392 Před 3 lety

      @@arjundixit5913 you're welcome, glad I could help! have a great day :)

  • @sophieyan5008
    @sophieyan5008 Před 8 lety +1

    Thanks a lot for this nice video, but I don't understand how you get n/2k = 1, this is the only step that confuses me. Thanks!

    • @AdityaPratapsingh9125
      @AdityaPratapsingh9125 Před 8 lety +1

      to eventually reach T(1) ...as n=1(n

    • @luvianp4984
      @luvianp4984 Před 8 lety

      k=log n; 2^(log n) = n; n/n=1; T(n/n) = c;

    • @santoshkumak
      @santoshkumak Před 7 lety +2

      For space complexity it is clear.
      At level L1, there are n/2^1 elements, at level L2 there are n/2^2 elements....so on We know at last level there are 1 elements in array and we say it as n/2^k , then n/2^k =1

  • @anupamsingh1453
    @anupamsingh1453 Před 7 lety

    Nice explanation the noise in the background is a bit disturbing.

  • @stormos25one
    @stormos25one Před 7 lety

    great video

  • @shreyashagrawal9650
    @shreyashagrawal9650 Před 3 lety

    Pls help getting infinite loop at merge (Larr)

  • @xuyuan4798
    @xuyuan4798 Před 4 lety

    Amazing