java - What is the algorithmic runtime of the removeFirst() method in a LinkedList? -
OK, so I know that a lot about the cost of various tasks on archive Good threads> gives a great overview of the difference between the interface ArrayList and LinkedList . But after reading that thread, I'm still unsure of one thing: removeFirst () / pollFirst () and removeLast () / pollLast () have algorithm runtime O (1) Or do I have to use Iterator to get it?
If you will see:
Perform all the tasks, Which can be expected for a double-linked list.
Then remove the head or tail o (1).
Comments
Post a Comment