How to insert a node after a position P in singly linked list? Data Structure

  • Newnode -> data = P ; Newnode -> next = p ->next ; P -> next = newnode ;
  • Newnode -> data = x ; Newnode -> next = p ->next ; P -> next = L ;
  • Newnode -> data = x ; Newnode -> next = p ->node ; P -> nextnode = next ;
  • Newnode -> data = x ; Newnode -> next = p ->next ; P -> next = newnode ;
Answer: Newnode -> data = x ; Newnode -> next = p ->next ; P -> next = newnode ;
826 students attemted this question.


No Explanation Available.

Share this question with friends

Similar Questions

  1. Two lists, A and B are implemented as singly linked link-lists. The address of the first and last node are stored in variables firstA and lastA for list A and firstB and lastB for list B. Given the address of a node is given in the variable node, the element stored in the node can be accessed by the statement node->data and the address to the next node can be accessed by node->next. Pankaj wants to append list B at end of list A. Which of the following statements should he use?

  2. Which of the following operations is performed more efficiently by doubly linked list than by singly linked list?

  3. A variant of linked list in which last node of the list points to the first node of the list is?

  4. State true of false.i) A node is a parent if it has successor nodes.ii) A node is child node if out degree is one.

  5. In linked list, the elements are using _________ to linked the data item to the next address in memory location.

  6. What does the following function do for a given Linked List with first node as head?

  7. In linked list each node is divided into ___________parts?

  8. Give syntax to create a node for Single linked list?

  9. In linked list each node contain minimum of two fields. One field is data field to store the data second field is?

  10. In circular linked list, insertion of node requires modification of?

  11. What kind of linked list is best to answer question like “What is the item at position n?”

  12. If node N is a terminal node in a binary tree then its ________

  13. Statement 1: When a node is split during insertion, the middle key is promoted to the parent as well as retained in right half-node.Statement 2: When a key is deleted from the leaf, it is also deleted from the non-leaf nodes of the tree.

  14. ._____________ is a data structure in which every individual node consists of INFO to store data and LINK to store the address of the next node.

  15. Linked list data structure offers considerable saving in _____________

  16. The disadvantage in using a circular linked list is __________

  17. What advantage does a linked list have over an array?

  18. Which of the following points is/are true about Linked List data structure when it is compared with array

  19. Linked list is considered as an example of ___________ type of memory allocation.

  20. Given a binary search tree, insert 27, 15, 63, 99, 70 and 85 (in this order) into the binary search tree. What is the post-order traversal?


Add Your Review

Your email address will not be published.

Subscribe to Newsletter!

Subscribe to get latest updates and information.