Warp wrote:
> Which is O(n) because you have to get there first.
I think that the insert happens after you already decide where to insert it.
What if the insert is always performed after the third element of the
list? You're back to O(1).
That's like saying appending to the end of an array with enough space is
O(n) because you first have to search thru the array to ensure the value you
want to insert isn't already there.
--
Darren New, San Diego CA, USA (PST)
I ordered stamps from Zazzle that read "Place Stamp Here".
Post a reply to this message
|