3 ms·
In what way does delete(a, i) look like an O(1) operation? It looks like a function call. You can never just look at a function call and see its complexity. Yo
by edflsafoiewq 8y ago
In what way does delete(a, i) look like an O(1) operation? It looks like a function call. You can never just look at a function call and see its complexity.
You make it sound like deleting an element being ugly is a design choice, but it can't be a choice since there is no alternative. Swap-and-pop is O(1), but it's ugly too.