|
|
|
|
|
by dwattttt
401 days ago
|
|
If that's a specific use case you need to handle, it's O(1) again if you have a pointer to both the node to be removed and the previous node. Whether it's more efficient to carry a second pointer around when manipulating the list, or store a second pointer in every list node (aka double linked list) is up to your problem space. Or whether an O(n) removal is acceptable. |
|