I have a question in doubly linklist | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I have a question in doubly linklist

Q. Suppose you have a double linked list. The address of first node is in Head pointer variable. Suppose you are given a node number n that denotes the number of a node i.e. if n=1 it means 1" node, if n=5 it means sth node. Every mode in the link list has following structure struct Linked List { int data; Linkedlist "previous, * next; } Write functions for following operations on this double linked list using c++. Don't write whole program, only functions are required. b) Read a node number in variable n. Search that node in the linked list. If that node is found then create a new node dynamically and Insert this new node after nth node. If nth node is not found then display appropriate message. Name this function as InsertNtNode.

28th Jul 2020, 3:59 AM
Mohammad Waqas
Mohammad Waqas - avatar
1 Answer
+ 1
while node. data < n goto next node if no more next node sh***t if node f found new node : - previous = f - next = next of f next node of f: previous = new node previous node of f: next = new node
28th Jul 2020, 5:26 AM
Oma Falk
Oma Falk - avatar