Write a program using LinkedList class and ListIterator interface to demonstrate the following activities: 1. Create a
Fantastic news! We've Found the answer you've been seeking!
Question:
Write a program using LinkedList class and ListIterator interface to demonstrate the following activities:
1. Create a singly linked list named "Alphabets" with four elements: "P", "Q", "R", and "T" in the same sequence. Create an iterator named "iter1" and attach it to the linked list.
2. Add a new element "O" at the beginning of the linked list.
3. Add a new element "U" at the end of the linked list.
4. Add a new element "S" after the element "R".
5. Remove the element "O" and "Q".
6. Display the linked list after performing each activity 1 to 5.
Sample output:
[P, Q, R, T]
[O, P, Q, R, T]
[O, P, Q, R, T, U]
[O, P, Q, R, S, T, U]
[P, R, S, T, U]
Related Book For
Niebels Methods, Standards and Work Design
ISBN: 978-0073376318
13th edition
Authors: Andris Freivalds, Benjamin Niebel
Posted Date: