Week6 LinkedList
Week6 LinkedList
To update the value of the node, we just need to set the data
part to the new value.
Below is the implementation in which we had to update the
value of the first node in which data is equal to val and we
have to set it to newVal.
Linked List node Updation
void updateLL(Node head, int val, int newVal)
{
Node temp = head
while(temp != NULL)
{
if( temp.data == val)
{
temp.data = newVal
return
}
temp = temp.next
}
}