Data Structure
Merge Sort
Learn data structure by example of merge sort algorithm
G
Geekboots4/23/2021
0 views
merge-sort-algorithm.cC
function merge(left,right)
var list result
while length(left) > 0 or length(right) > 0
if length(left) > 0 and length(right) > 0
if first(left) <= first(right)
append first(left) to result
left = rest(left)
else
append first(right) to result
right = rest(right)
else if length(left) > 0
append first(left) to result
left = rest(left)
else if length(right) > 0
append first(right) to result
right = rest(right)
end while
return resultmerge sort algorithmdata structurealgorithmmerge sort
Loading comments...







