タグ

ブックマーク / www.codecodex.com (1)

  • Merge sort

    Implementations[edit] Pseudocode[edit] function mergesort(m) var list left, right if length(m) ≤ 1 return m else middle = length(m) / 2 for each x in m up to middle add x to left for each x in m after middle add x to right left = mergesort(left) right = mergesort(right) result = merge(left, right) return result There are several variants for the merge() function, the simplest variant could look li

  • 1