InterviewSolution
| 1. |
How To Insert A Node At The Beginning Of The List? |
|
Answer» Inserting a node at the beginning of the list is probably the easiest of all operations. LET’s talk about what is involved here referring to the diagram above. This involves creating a NEW node (with the new data, say INT 10), making its link point to the current first node pointed to by head (data value 2) and lasting changing head to point to this new node. Simple, right. Inserting a node at the beginning of the list is probably the easiest of all operations. Let’s talk about what is involved here referring to the diagram above. This involves creating a new node (with the new data, say int 10), making its link point to the current first node pointed to by head (data value 2) and lasting changing head to point to this new node. Simple, right. |
|