As I am reviewing big O notation for data structures and algorithms, I am confused when different sources place a O(n) time complexity for deleting a node from a linked list vs O(1). For example, big O cheat sheet places O(1) when deleting a node where as I believed that removing a node would be O(n) because you must find the node first and then delete it.
So my question is, does the time complexity of O(1) just assume the operation of deletion itself without taking into consideration that the node must be found first? Let us assume that the node to be deleted is anywhere in the list not just at the front or end of the list.
I have reviewed the following questions, but they do not address my question:
big O notation for removing an element from a linked list
Big-O summary for Java Collections Framework implementations