Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello please include java screenshots of the code along with the out put much appreciated :) Implement a doubly linked list - the MyLinkedList class

Hello please include java screenshots of the code along with the out put much appreciated :)

Implement a doubly linked list - the MyLinkedList class in Chapter 24 is a one-way directional singly linked list that enables on-way traversal of the list. Modify the Node class to add the new data field name previous to refer to the previous node in the list, as follows:

public class Node { E element; Node next; Node previous; public Node(E e) { element = e; } }

Implement the following methods in MyDoublyLinkedList.

  1. public MyLinkedList()
  2. public MyLinkedList(E[] objects)
  3. public E getFirst()
  4. public E getLast()
  5. public void addFirst(E e)
  6. public void addLast(E e)
  7. public void add(int index, E e)
  8. public E removeFirst()
  9. public E removeLast()
  10. public E remove(int index)
  11. public String toString()
  12. public void clear()
  13. public boolean contains(Object e)
  14. public E get(int index)
  15. public int indexOf(Object e)
  16. public int lastIndexOf(E e)
  17. public E set(int index, E e)
  18. public int size()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions