Struct node <br/>{< br/> int data; <br/> struct node * Prior; <br/> struct node * Next; <br/> }; </P> <p>/** <br/> * @ brief this function inserts an element before the I node in the lead node double-Link Table. <br/> * @ Param [in] Head linked list of nodes to be inserted <br/> * @ Param [in] I location of nodes TO BE INSERTED <br/> * @ Param [in] e node value to be inserted </ p> <p> * @ author wlq_729@163.com <br/> * http://blog.csdn.net/rabbit729 <br/> * @ version 1.0 <br/> * @ date <br/> */<br/> int insertdoublelist (node * head, const int I, const int e) <br/>{< br/> assert (head); <br/> If (Head-> next = NULL) <br/>{< br/> return-1; <br/>}</P> <p> // locate the node to be inserted <br/> Int J = 0; <br/> node * P = head; <br/> while (P-> next! = NULL) & (j <I) <br/>{< br/> P = p-> next; <br/> J ++; <br/>}</P> <p> // insert a node <br/> node * q = new node; <br/> assert (Q ); <br/> q-> DATA = E; <br/> q-> prior = p-> prior; <br/> P-> prior-> next = Q; <br/> q-> next = P; <br/> P-> prior = Q; <br/> return 0; <br/>}</P> <p>/** <br/> * @ brief this function implements the first node that is equal to the given value in the dual-Link Table of the lead node. insert node <br/> * @ Param [in] head to be inserted to the node linked list <br/> * @ Param [in] e location of the node to be inserted <br/> * @ Param [in] data to be inserted Node value </P> <p> * @ author wlq_729@163.com <br/> * http://blog.csdn.net/rabbit729 <br/> * @ version 1.0 <br/> * @ date <br/> * /<br/> int insertdoublelist1 (node * head, const int e, const int data) <br/>{< br/> assert (head); <br/> If (Head-> next = NULL) <br/>{< br/> return-1; <br/>}</P> <p> // locate the node to be inserted <br/> node * P = head-> next; <br/> while (P! = NULL) & (p-> data! = E) <br/>{< br/> P = p-> next; <br/>}</P> <p> // insert node <br/> If (P! = NULL) & (p-> DATA = E) <br/>{< br/> node * q = new node; <br/> assert (Q ); <br/> q-> DATA = E; <br/> q-> prior = p-> prior; <br/> P-> prior-> next = Q; <br/> q-> next = P; <br/> P-> prior = Q; <br/> return 0; <br/>}< br/> else <br/>{< br/> cout <"cocould not find data! "<Endl; <br/> return-1; <br/>}< br/>}