3 ms·
I've been pretty seriously studying CS for a while, and there's a trillion things I don't know. >If they ask you to merge sorted arrays and you don't know that
by Retra 10y ago
I've been pretty seriously studying CS for a while, and there's a trillion things I don't know.
>If they ask you to merge sorted arrays and you don't know that Heap sort is the best way to do it, you've lost the interview no matter [...]
... no matter the fact that there are a hundred ways to sort an array, and you think you know the best one? Has it been proven the best, or is it just the best you know? How many ways do you actually know to sort an array? Has all research on array sorting ground to a halt because there's no better way to do it?
If someone asked me the best way to sort an array I'd say "probably radix sort." If you expected "merge sort," then you're the fool.
My point being, I study a lot, but that doesn't give you answers. I gives you a base from which further study can happen.
- SonOfLilit 10y agoHis question was about merging pre-sorted arrays, not about sorting arrays. (Still, see my own disagreement in sibling)
- lightbendover 10y ago"Tell me more about the array you want me to sort" is the only valid initial response to "best way to sort an array." That said, the question posed had very little to do with sorting arrays and I'm not sure where your hostility came from.
- Retra 10y agoMy objections had nothing to do with the kind of question posed, only the expected response. Unless it's been proven that there can be no way to merge sorted arrays "better" than heap sort, it's flippant and erroneous to expect someone to give that answer. (And there are real reasons to not use heap sort for this.) Even if I don't know that this is the (supposedly) correct answer, they've learned little about my ability to actually merge sorted arrays, and even less about my general ability to solve problems. Unless they're explicitly hiring me to merge sorted arrays, I'm not going to claim any expertise at at. There are probably hundreds of research papers on this topic, and I haven't read them all, and I know it. I understand that sorting is a big CS topic, but it's not the only CS topic, and I can go the rest of my carrier assuming someone else already solved it and never know how heap sort is implemented and still solve hard problems. So they shouldn't ask that kind of question and expect such a casually incorrect answer. And they can't tell me "I've already lost the interview" if I don't see things this way, because then that might trigger some manner of hostility. I don't lose interviews when the interviewer expects careless and rote answers. The company loses.