data structures using compare arr[iand arr[ ]the smaller of the two is placed in temp at the location specified by index and subsequently the value or is incremented beg beg beg beg mid mid mid imid temp index end end end end imid beg end mid beg index index index index index end when is greater than midcopy the remaining elements of the right sub-array in temp beg mid end merge (arrbegmidendstep [initializeset begj mid index step repeat while ( <midand ( <=endif arr[iarr[jset temp[indexarr[iset else set temp[indexarr[jset [end of ifset index index [end of loopstep [copy the remaining elements of right sub-arrayif anyif mid repeat while <end set temp[indexarr[jset index index set [end of loop[copy the remaining elements of left sub-arrayif anyelse repeat while <mid set temp[indexarr[iset index index set [end of loop[end of ifstep [copy the contents of temp back to arrset kstep repeat while index set arr[ktemp[kset [end of loopstep end index