#Singly Linked List (Don't Understand

1 messages · Page 1 of 1 (latest)

clever sandal
#

Hi, I've been reviewing for a midterm and this is a question from a past midterm. I don't agree with the solution, can someone tell me when I am incorrect?

magic crownBOT
#

<@&987246399047479336> please have a look, thanks.

#

Here is an AI assisted attempt to answer your question 🤖. Maybe it helps! In any case, a human is on the way 👍. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.

#

Sure, I'd be happy to help. Can you please provide the question and the solution that you disagree with?

clever sandal
#

This is the full question

#

This is my work and my solution:

#

its almost exactly the same

#

I just crossed out the node that contains 5, because q got reassigned in the line "else q=p" at the end of the second while loop

#

why is the 5 node still there after variable q got reassigned? Can someone explain that please?