Menu Close

Remove nodes from Linked List

swap():

  • This function is used to swap data of specified nodes.
  • This function takes 2 locations in the list and swap data.

addAfter():

  • This function is used to add element after the specified node.
  • If the location is not present, it returns Error message.
  • If the location is present, it creates the node and add the element after the specified node in the list.

removeFirst():

  • This function removes the first element in the list.
  • If the list is empty, it returns Error message.
  • If the list has elements, it removes the first element and the root pointer is pointing to second node.

removeAfter():

  • This function is used to removes the element after the specified node.
  • If the specified location is not present, it display Error Message.