Answered You can hire a professional tutor to get the answer.

QUESTION

Consider the declaration and initialization below:

1.    Consider the declaration and initialization below:

class Link {

  public int data;            // data item

  public Link next;           // next link in list

  public Link previous;       // previous link in list

} // end class Link

class DoublyLinkedList {

  private Link first;         // ref to first item

  private Link last;          // ref to last item

  // insert at front of list

 public void insertFirst(int newData) 

  // insert at end of list

 public void insertLast(int newData)  

  public Link deleteFirst()   // delete first link

  public Link deleteLast()    // delete last link

  // (assumes non-empty list)

 public boolean insertAfter(int key, int newData)

  // delete item with given key

 // (assumes non-empty list)  

  public Link deleteKey(int key)  

  public void displayForward()

  public void displayBackward()

     } // end class DoublyLinkedList

what is the algorithm for each of the above method signature.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question