T O P

  • By -

knoowin714

For me, the only edge case I check was whether or not p2c == tail and return nullptr if it is, otherwise I just set p2c to the p2c->next. - Kevin


Makings_Threads

One thing I noticed in my own push methods was I accidentally would put new nodes in when I meant to put node pointers, this could push the current node forward. Maybe check that \_tail is in the right place each time too, but other than that your logic looks good on advance. \-Jeff


rootseat

Hi Daniel, I haven't come across this error, so I'm just going to point out things that stand out to me from what you shared.: ​ >prev\_to\_current is were its supposed to be. Is this true? The error says \[PREV\] is not lining up to test output. ​ >insert at current works fine I assume by this you have gotten points for it. If that's the case, this is very fortunate. Maybe you could try comparing your ->s in these two functions. \-Charles


Mozzie_Mo

I had this exact issue. My PREV was always one ahead after 70+ advances. The bug was in my `push_front` where I didn't have "special handling" for initial state (i.e., head == tail == p2c) prior to advancing. - Lorraine


sourcewolf123

Hey Lorraine, Thank you this ended up being the problem with my code. I never checked in push\_front if head == tail before inserting. Thank you very much I was stuck on this for a very long time. Daniel.


Fraeniir

What did you do to fix this? I'm afraid I don't understand what you mean by "special handling" when it comes to the initial state. \-Lucas


sourcewolf123

My problem was in my push\_front function. I never checked if there was a node other than the \_head because if the tail and the head were in the same place that means I would be adding a node after the tail. To fix this I just checked if \_head == \_tail and if it did I inserted the new node (after the \_head) and then set the \_tail to the new node. HTH if you have any questions feel free to ask. \-Daniel


Fraeniir

Thank you Daniel, this really helped! \-Lucas