• Eheran@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    12 hours ago

    How does the last step sort an of the sizes? Why even have all the other steps if that one can do it all?

    • SmoothLiquidation@lemmy.world
      link
      fedilink
      English
      arrow-up
      0
      ·
      12 hours ago

      When you merge two sorted lists, you only have to compare the first element of each, since you can trust that all of the other elements are bigger. All the steps before that are there to make sure that is true.