Insert node in a Linked ListEasy
You're given the following 2 inputs:
datafor a new node to be inserted in a singly linked list.
- The node
left_nodethat the new node should be inserted after.
Write a function that inserts the new node after the
left_nodein its singly linked list.
For example, let's use the following linked list as an example:
(1) -> (5) -> (7) -> (2)
If your function is passed the data
8and the third node in the above list with the data
7, the linked list should become:
(1) -> (5) -> (7) -> (8) -> (2)
Assume that the input
left_nodecan be any node in the list..