Thanks. Most other videos I found stored the left and right arrays in their own separate arrays, completely nullifying the point of more efficient space complexity over merge sort. There's no reason to use this otherwise, as the in-place sorting is the whole point. Other than it being a tail-recursive function I guess.
I think the point of the exercise was to implement the sort mechanism from scratch. Of course there's a built in sort function thats based on the quick-sort algorithm. If it was that easy, then this problem will be tagged easy.
Best vid I found today for understanding quick sort. Thank you!
Thanks. Most other videos I found stored the left and right arrays in their own separate arrays, completely nullifying the point of more efficient space complexity over merge sort. There's no reason to use this otherwise, as the in-place sorting is the whole point. Other than it being a tail-recursive function I guess.
Hi sir, These leetcode videos are amazing, please make more videos like this, Thanks
What if left is not greater than right in the beginning?
Thank you so much!
Great vid!
My answer:
var sortArray = function(nums) {
let sortedArray = nums;
sortedArray.sort(function(a,b){return a-b});
return sortedArray;
};
I think the point of the exercise was to implement the sort mechanism from scratch. Of course there's a built in sort function thats based on the quick-sort algorithm. If it was that easy, then this problem will be tagged easy.
in interviews you will not be able to use sort()
@@jokwonpope1561 thanks for that, I had just started JS when I posted that comment
Great!😅