Ask your own question, for FREE!
Computer Science 14 Online
OpenStudy (anonymous):

How do I implement this function in a sequence class with a linked list toolkit? // void remove_current( ) // Precondition: is_item returns true. // Postcondition: The current item has been removed from the sequence, and the // item after this (if there is one) is now the new current item.

OpenStudy (anonymous):

void sequence::remove_current () { if (is_item ==true) node *target_ptr; target_ptr=list_search(head_ptr, target); if (target_ptr == NULL) return false; target_ptr-> set_data(head_ptr-> data()); list_head_remove(head_ptr); --many nodes; return true; } } How do I fix my code above?

OpenStudy (rsmith6559):

To remove a node in a singly linked list you just need to change the target node predecessor's pointer from target node to target node's successor, keeping track of target node's address so that you can then delete it. This will put a bit of a crimp in how you search for the target node, because you'll also need it's predecessor. Draw it out on paper.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
kaelynw: art igg
2 hours ago 6 Replies 1 Medal
XShawtyX: Art
13 hours ago 6 Replies 0 Medals
Nina001: teach me how to draw or just tell me the basics
16 hours ago 2 Replies 1 Medal
XShawtyX: We doing another drawing gimme ideas to add to this
17 hours ago 9 Replies 1 Medal
RAVEN69: What is x 3+y 3+z 3=k
21 hours ago 20 Replies 1 Medal
cinna: Who is good with photo editing? Dm me pls
1 day ago 2 Replies 0 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!