You are viewing a single comment's thread. Return to all comments →
I just hacked in a check at the beginning:
if (head->data == 2) { delete head; head = nullptr; }
And then another special case hack to insert a node containing 2 after the 4.
Seems like cookies are disabled on this browser, please enable them to open this website
Insert a node at a specific position in a linked list
You are viewing a single comment's thread. Return to all comments →
I just hacked in a check at the beginning:
if (head->data == 2) { delete head; head = nullptr; }
And then another special case hack to insert a node containing 2 after the 4.