I need to delete an element from linked list where address of that element is given.Something like this
1->2->3->4->5
a1 a2 a3 a4 a5 where a1,a2..a5 are addresses of elements 1,2 ..5 respectively.
sum1 just says delete(a3) N since I have no access to header of given list.
I cant traverse the whole linked list and compare the address with the asked address.
Question is how I delete a particular element from the given list with no other information given.
Classic interview question.
You don’t delete that element, but copy the next element into it:
So you do: