I'm trying to implement a circular doubly linked list but I'm having issues when trying to set the previous pointer. If I set the head's previous pointer to the new node, my program hangs but when I don't it performs moderately well.
Below is the code that makes the program hang:
head->next = newNode;
head->prev = newNode;
newNode->next = head
The line newNode->next = head causes my program to hang indefinitely, what am I doing wrong with my implementation in the function?
Aucun commentaire:
Enregistrer un commentaire