3 ms·
- I think you mean quicksort is O(n log n), not O(log n). - I actually think you mean O(n^2), unless you specifically say you are talking about the average cas
by geophile 6y ago
- I think you mean quicksort is O(n log n), not O(log n).
- I actually think you mean O(n^2), unless you specifically say you are talking about the average case, which you didn't mention.
- For interviewing: if you ask a shallow question you get a shallow answer. So if you don't follow up and ask why foobarsort is O(n log n), then of course you are going to have people game the question.
- Having rich standard libraries should not be an excuse for ignorance. I have interviewed people who find a suitable thing in some standard library, and call it a day. Why an ordered map instead of unordered? Why this data structure choice instead of that one (the library supports both)? They don't know. If you can answer a big O question intelligently, and you can give me reasons for your choices good. Otherwise, I recommend against hiring.
- Why so complicated? Obviously n! <= n^n. So log(n!) < log(n^n) and log(n^n) is n log(n). (Since you just want the big O.)