Re: Teach me CS stuff for interviews
I was just going to edit my post stating that quicksort was O(n^2) haha. Although, I didn't make any conjecture saying that quicksort was the best comparative based algorithm so its not like I lied :P although, quicksort does have an average run time of O(nlogn) (I forgot which Greek letter denotes average time, my bad). And I believe the coefficients/constants are also decent if you consider f(x) where f(x) "=" O(g(x)). Also, I'd say each of the popular sorting algorithms has its pros and cons compared to others, you can only say which one is best depending on the situation imho (ex: merge sort is simple and elegant but uses up a lot more space)
I was just going to edit my post stating that quicksort was O(n^2) haha. Although, I didn't make any conjecture saying that quicksort was the best comparative based algorithm so its not like I lied :P although, quicksort does have an average run time of O(nlogn) (I forgot which Greek letter denotes average time, my bad). And I believe the coefficients/constants are also decent if you consider f(x) where f(x) "=" O(g(x)). Also, I'd say each of the popular sorting algorithms has its pros and cons compared to others, you can only say which one is best depending on the situation imho (ex: merge sort is simple and elegant but uses up a lot more space)




Comment