Remove an item from a singly linked list. Next: do it with no additional memory usage
Anónimo
You int need to replace any element. In case of your example, just iterate till (node.next.value == delete_element_val). Then just do (node.next = node.next.next). In this method, you have to take care of special case where the element to be deleted is last element. So : No extra memory, no replacement and Complexity is O(n) with auxiliary O(1).