Title: Merge Sort in Python - Runnable Code Snippet
Open Graph Title: Merge Sort in Python - Runnable Code Snippet
X Title: Merge Sort in Python - Runnable Code Snippet
Description: Sort an array using the merge sort algorithm with O(n log n) time complexity. Runnable Python snippet with live execution.
Open Graph Description: Sort an array using the merge sort algorithm with O(n log n) time complexity. Runnable Python snippet with live execution.
X Description: Sort an array using the merge sort algorithm with O(n log n) time complexity. Runnable Python snippet with live execution.
Keywords:
Opengraph URL: https://tempercode.dev/snippets/merge-sort-python
Domain: tempercode.dev
{"@context":"https://schema.org","@type":"SoftwareSourceCode","name":"Merge Sort","description":"Sort an array using the merge sort algorithm with O(n log n) time complexity.","programmingLanguage":"Python","text":"def merge_sort(a):\n if len(a) <= 1:\n return a\n mid = len(a) // 2\n left, right = merge_sort(a[:mid]), merge_sort(a[mid:])\n result = []\n while left and right:\n result.append(left.pop(0) if left[0] <= right[0] else right.pop(0))\n return result + left + right\nreturn merge_sort(arr)"}
| theme-color | #0c0d12 |
| color-scheme | dark |
| author | Temper |
| creator | Temper |
| publisher | Temper |
| og:image | https://tempercode.dev/og-image.png |
| og:type | article |
| twitter:card | summary_large_image |
| twitter:image | https://tempercode.dev/og-image.png |
Links:
Viewport: width=device-width, initial-scale=1