Leetcode Problem 912. Sort an Array

912. Sort an Array

Leetcode Solutions

Merge Sort

  1. If the array has more than one element, find the middle index.
  2. Recursively apply merge sort to the left half of the array.
  3. Recursively apply merge sort to the right half of the array.
  4. Merge the two sorted halves into a single sorted array.
UML Thumbnail

Heap Sort

Ask Question

Programming Language
image/screenshot of info(optional)
Full Screen
Loading...

Suggested Answer

Answer
Full Screen
Copy Answer Code
Loading...