The following steps in a linked list
p = getnode() info (p) = 10 next (p) = list list = p
result in which type of operation?
(A) pop operation in stack
(B) removal of a node
(C) inserting a node
(D) modifying an existing node
Answer: (C)
Explanation: p = getnode() // getnode() allocates the space which is equal to the size of the node type structure and returns a pointer.
info (p) = 10 // value of the new node is equal to 10
next (p) = list // adding new node to the list.
Clearly, through these steps, insertion of a node is performed.
Option (C) is correct.
Quiz of this Question
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.