Inactive Tutor answered 09/25/21
It is a circular linked list.
The head pointer after the delete is now pointing to the element 2.
Fix the code to point it to the element 1.
You would then see [1,2,3] after the delete.
Brittney P.
asked 09/25/21Here I have my code that deletes a given integer value from a circular linked list:
My code works until the temp node is equal to the tail. For example, let's say I have a circular linked list and the data (not memory allocation) within a list would be [1,2,3,4]. If I want to delete 4 out of the circular linked list, it will delete it but the order is [2,3,1]. The first element then appears at the end of the list. I'm not sure exactly what I have done wrong. I know the error is in the second if statement.
Inactive Tutor answered 09/25/21
It is a circular linked list.
The head pointer after the delete is now pointing to the element 2.
Fix the code to point it to the element 1.
You would then see [1,2,3] after the delete.
Get a free answer to a quick problem.
Most questions answered within 4 hours.
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.
Brittney P.
Thank you so much!09/25/21