Thanks for all your replies -- that was of great help.
I figured now where's the trick to use of looking ahead of two pointers at a time,
currentptr -> nextptr -> nextptr
Yara
User Profile
Collapse
-
Thanks RRick for your answer. It's not an exact homework question! The problem of deleting a node from a singly linked list using one pointer, to the best of my knowledge, is somewhat a challenging, or better to say, a tricky problem. Once the trick is revealed, it becomes a routine work.
To delete from the beginning is so easy, with a one pointer. As I pointed earlier, the process has to search for an item, then deletes the node that...Leave a comment:
-
Sinlge linked List -> Delete Using One Pointer
Hi dear friends,
This problem might be so popular to some of you, but I couldn't be able to do it myself.
The problem: How to delete a node from a single linked list using only one pointer?
Where the target node to be deleted has a key field, and based on a match, let us say at first a sequential search, this node has to be deleted.
What other ways that a singly linked list can be searched...
No activity results to display
Show More
Leave a comment: