Coronavirus made it tough but we keep working remotely with no delays. Get 15% OFF your First Order
Get 15% OFF your First Order


help me complete the add method

I’m trying to learn for my Java class and I’m stuck. Can you help?

help me finish the add(int index, E value)method on handwritten linked list. The code in the attatchment

Add a method void add(int index, E value) which adds a new node at the indexth spot in list

The algorithm is the following:

  • create a new node with value in it
  • if head is null, the list is empty, so just set head and tail to the new node
  • If head is not null, loop to the node in front of where you want to put the new node (see toString() for a model of looping through a linked list). Then set the new node’s next pointer to the next node ahead, and the previous node’s next pointer to the new node. Reassign tail if necessary.

Looking for this or a Similar Assignment? Click below to Place your Order

× How can I help you?