Hey Andy, excellent tutorial. I have one question however. Is it okay to use the js built in sort method in an interview or am I expected to implement a sort algo?
could you explain how the space is O(n) when you're sorting an array with O(n) where n is the length of the input and you're doing n log n work to sort it? The function is O(n). Perhaps you made a mistake and reversed them when speaking and typing? Runtime should be O(n) and Space should be O(n x n logn)
Space complexity is O(n) because the hash grows linearly depending on how many words are there in the input array. Time complexity is O(n*nlogn) because any sorting algorithm (except radix sort) would require comparisons between every letter and on top of that, there was another for loop to run through the sorted array.
Very informative.
Thanks for sharing
Excellent, well done Andy
Hey Andy, excellent tutorial. I have one question however. Is it okay to use the js built in sort method in an interview or am I expected to implement a sort algo?
nice one andy, thanks again
nice explanation
Damn it I spent way to long on this problem
Bro
Please do more regular videos
could you explain how the space is O(n) when you're sorting an array with O(n) where n is the length of the input and you're doing n log n work to sort it? The function is O(n). Perhaps you made a mistake and reversed them when speaking and typing? Runtime should be O(n) and Space should be O(n x n logn)
Space complexity is O(n) because the hash grows linearly depending on how many words are there in the input array. Time complexity is O(n*nlogn) because any sorting algorithm (except radix sort) would require comparisons between every letter and on top of that, there was another for loop to run through the sorted array.