I was told that something could be done like that, but it’s confusing, I don’t quite understand:
struct Node{ int value; Node* next; Node* prev; }; void insert(Node*n, int val) { Node*a = new Node; n->next = a; a->next = n->next; a->value = val; n->value = a->value; }
forward_listis aforward_listlinked list. It should not have a link to the previous item. And if there is such a link, then this is already a doubly linked list, i.e.list- zed