3 ms·
No, latency didn't come up. (I agree that could be a reason not to use a dynamic array.) They were hung up on the idea that a dynamic array must be O(n) because
by munificent 5y ago
No, latency didn't come up. (I agree that could be a reason not to use a dynamic array.) They were hung up on the idea that a dynamic array must be O(n) because at least some of the appends copy.
- 8note 5y agoAssuming you can average over all requests imposes that latency does not matter, doesn't it? If you're the interviewee, it's up to you to get that clarification
- munificent 5y agoThe question they asked was about its complexity in big-O terms, not so much about its real world performance, at least as I recall.
- deleted 5y ago[deleted]
- qu4z-2 5y agoYou explicitly said they were hung up on the "worst case O(n)" situation, so I suspect they were concerned about the latency. Insertion into a dynamic array has a worst case of O(n) and an average case of O(1), no?