Time complexity of node deletion in singly- and doubly-linked lists
问题 Why is the time complexity of node deletion in doubly linked lists (O(1)) faster than node deletion in singly linked lists (O(n))? 回答1: The problem assumes that the node to be deleted is known and a pointer to that node is available. In order to delete a node and connect the previous and the next node together, you need to know their pointers. In a doubly-linked list, both pointers are available in the node that is to be deleted. The time complexity is constant in this case, i.e., O(1).