linked list

how do i insert and delete any node between the first node and last node in the list.


  • If you want to insert "new" node after "current" node, then your logic would be
    new->next = current->next
    current->next = new

    if you want to delete "current" node which comes after "previous", then your logic would be
    previous = current
    current = previous->next
    previous->next = current->next

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion