Why is deleting in a single linked list O(1)?
I do not quiet understand why deleting at the end of a single linked list goes in O(1) time, as the wikipedia article says. A single linked list consists out of nodes. A node contains some kind of data, and a reference to the next node. The reference of the last node in the linked list is null. -------------- -------------- -------------- | data | ref | -> | data | ref | -> ... -> | data | ref | -------------- -------------- -------------- I indeed can remove the the last node in O(1). But in that case you don't set the reference of the newly last node, the previous one, to null since it still