Linked Lists Method Question (need help) [code provided]

Programming
Tutor: None Selected Time limit: 10 Days

Hey guys, below is a piece of code. Underneath that is what I am trying to accomplish with my code, but am confused on what to do. Can someone please help?

public class PlayerLinkedList extends ShellLinkedList
{

  public PlayerLinkedList(  )
  {
  super( );
  }

  public void insert( Player p )
  {
  // insert as head
  PlayerNode pn = new PlayerNode( new Player(  p ) );
  pn.setNext( head );
  head = pn;
  numberOfItems++;
  }

  public Player delete( int searchID )
  throws DataStructureException
  {
  PlayerNode current = head;
  PlayerNode previous = null;
  while ( current != null
  && current.getPlayer( ).getID( ) != searchID )
  {
  previous = current;
  current = current.getNext( );
  }

  if ( current == null ) // not found
  throw new DataStructureException( searchID
  + " not found: cannot be deleted" );
  else
  {
  if ( current == head )
  head = head.getNext( );  // delete head
  else
  previous.setNext( current.getNext( ) );

  numberOfItems--;
  return current.getPlayer( );
  }
  }

 
  public Player peek( int searchID )
  throws DataStructureException
  {
  PlayerNode current = head;
  while ( current != null
  && current.getPlayer( ).getID( ) != searchID )
  {
  current = current.getNext( );
  }

  if ( current == null ) // not found
  throw new DataStructureException( searchID
  + " not found: cannot be deleted" );
  else
  {
  return current.getPlayer( );
  }
  }
}


I want to include one more method that inserts a new player in the third position of the list. Head would be the first position. If the list is empty, the method will insert the new player as the head of the list.

Can anyone please help me with this? I would really appreciate it.

Nov 30th, -0001
You should ask your programming questions at likeplum. I always get good answers there to my programming issues and questions. Especially about php, js or html questions…They have programmers online to help you asap. It's free.

https://www.likeplum.com/user/learn/programming/aid/2
Jul 2nd, 2013

Studypool's Notebank makes it easy to buy and sell old notes, study guides, reviews, etc.
Click to visit
The Notebank
...
Nov 30th, -0001
...
Nov 30th, -0001
Dec 11th, 2016
check_circle
Mark as Final Answer
check_circle
Unmark as Final Answer
check_circle
Final Answer

Secure Information

Content will be erased after question is completed.

check_circle
Final Answer