We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
1-You have to make sure the target node does not refrence anything. FOr exmaple if head is the target node, make head to point to the second element. By doing this, in Java, teh garbage colector will delete that target for you (asumming nothing else is pointing to it). In C++ you have to actulay write a delete stametmen to delete the node.
2- make sure nothing else is pointing to the target. If the target is the second node, you have to make sure head points to the 3rd node...
It is just pointers.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Delete a Node
You are viewing a single comment's thread. Return to all comments →
1-You have to make sure the target node does not refrence anything. FOr exmaple if head is the target node, make head to point to the second element. By doing this, in Java, teh garbage colector will delete that target for you (asumming nothing else is pointing to it). In C++ you have to actulay write a delete stametmen to delete the node.
2- make sure nothing else is pointing to the target. If the target is the second node, you have to make sure head points to the 3rd node...
It is just pointers.