912. Sort an Array c++solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> sortArray(vector<int>& nums) {\n        int n = nums.size();\n        mergeSort(nums, n);\n        return nums;\n    }\n    void mergeSort(vector<int> &A, int n)\n    {\n        if (n < 2)\n            return;\n        int mid = n / 2;\n        vector<int> L;\n        vector<int> R;\n\n        for (int i = 0; i < n; i++)\n        {\n            if (i < mid)\n            {\n                L.push_back(A[i]);\n            }\n            else\n                R.push_back(A[i]);\n        }\n        mergeSort(L, L.size());\n        mergeSort(R, R.size());\n        mergeArrays(A, L, R);\n    }\n\n    void mergeArrays(vector<int> &A, vector<int> &L, vector<int> &R)\n    {\n\n        int sizeL = L.size();\n        int sizeR = R.size();\n        int i = 0, j = 0, k = 0;\n\n        while (i < sizeL && j < sizeR)\n        {\n            if (L[i] <= R[j])\n            {\n                A[k] = L[i];\n                i++;\n            }\n            else\n            {\n                A[k] = R[j];\n                j++;\n            }\n            k++;\n        }\n        while (i < sizeL)\n        {\n            A[k] = L[i];\n            i++;\n            k++;\n        }\n        while (j < sizeR)\n        {\n            A[k] = R[j];\n            j++;\n            k++;\n        }\n    }\n};\n```
['C++']