I need to make a double-linked list. I have code for a single-linked linked list.
example code(single-linked):
1 2 3 4
void Network::push_front(int e, string i, string os, int s) {
NetworkNode *newone = new NetworkNode(e,i,os,s,start);
start = newone;
return;
Network is the "List", NetworkNode is the "Node".
I have a *next and *previous to point to the next node and previous node. I also have a start and end pointer pointing to the beginning and end of the list.
This function is to add nodes containing 4 types of data. How do I update both the next and pointer as I add nodes to the list?