<prompt> Andika msimbo wa uwongo ili kutekeleza upangaji wa kuunganisha.  <response>: kazi ya mergeSortorodha base case: ikiwa orodha ina vipengele 1 au 0, zingatia kuwa imepangwa na urudishe ikiwa list.length 1 kisha rudisha orodha pata kipengele cha kati cha orodha na ukigawe kuwa nusu mbili katikati list.length 2 leftNusu orodha0, 1, ..., katikati-1 kuliaNusu orodhakatikati, kati1, ..., N-1 piga tena simu mergePanga kwenye nusu ya kushoto na nusu ya kulia ya orodha leftSorted mergeSortleftHalf rightSorted mergeSortrightHalf unganisha orodha mbili zilizopangwa matokeo unganishaleftParted, rightSorted tokeo la kurudisha matokeo unganishaleftSorted, rightSorted result leftIndex 0 rightIndex 0 keep looping hadi tuwe tumeambatisha vipengele vyote katika leftSorted au rightSorted while leftIndex leftSorted.length AU rightIndex rightSorted.length kama orodha zote mbili zina vipengele vilivyosalia ikiwa leftIndex leftSorted .length AND rightIndex rightSorted.length kisha compare vipengele vya kwanza vya orodha zote mbili na uambatanishe kile kidogo zaidi kwa matokeo ikiwa leftSortedleftIndex rightSortedrightIndex then result.appendleftSortedleftIndex leftIndex leftIndex tokeo lingine 1. ongeza rightSortedrightIndex rightIndex rightIndex 1 pekee orodha ya kushoto ina vipengee vilivyosalia elseif leftIndex leftSorted.length then result.appendleftSortedleftIndex leftIndex leftIndex 1 only the orodha ya kulia ina vipengee vilivyosalia tokeo lingine. ongeza rightSortedrightIndex rightIndex RightIndex 1 matokeo ya kurejesha 