Question: Include these 2 programs (make sure all code compiles before submitting). Use these templates for your programs. 1. LinkedListAddRemove: LinkListAddRemoveTemplate.java Output: Cindy LeAnn Larry After

 Include these 2 programs (make sure all code compiles before submitting).Use these templates for your programs. 1. LinkedListAddRemove: LinkListAddRemoveTemplate.java Output: Cindy LeAnnLarry After removing second element: Cindy Larry 2. DoublyLinkedLists (see .pptx in

Include these 2 programs (make sure all code compiles before submitting). Use these templates for your programs. 1. LinkedListAddRemove: LinkListAddRemoveTemplate.java Output: Cindy LeAnn Larry After removing second element: Cindy Larry 2. DoublyLinkedLists (see .pptx in Module for coding assistance): DlinkedListTemplate.java Output: The elements of the list are: AI Amy Beth Bob Carol import java.util.*; public class LinkListAddRemove Template{ public static void main(String args[]){ 1/Adding elements to the Linked list //Removing First element //Same as list.remove(0); //Removing Last element //Iterating LinkedList //removing and element, index starts with o //Iterating LinkedList again class DLinkedList Template { private class Node { String value; // Value of a list element Node next; // Next node in the list Node prev; 1/ Previous element in the list Node (String val, Node n, Node p) Node (String val) { this(val, null, null); } public DLinkedList { public boolean isEmpty public int size) public void add(String e) public void add(int index, String e) public String toString() StringBuilder strBuilder = new StringBuilder(); public String remove(int index) public boolean remove(String element) Node pred = target.prev; // Node before the target Node succ = target.next; 1/ Node after the target public static void main(String [] args) { DLinkedList 1l = new DLinkedList(); 11.add("Amy"); 11.add("Bob"); 11.add(@, "Al"); 11.add(2, "Beth"); 11.add(4, "Carol"); System.out.println("The elements of the list are:"); System.out.println(11); } Include these 2 programs (make sure all code compiles before submitting). Use these templates for your programs. 1. LinkedListAddRemove: LinkListAddRemoveTemplate.java Output: Cindy LeAnn Larry After removing second element: Cindy Larry 2. DoublyLinkedLists (see .pptx in Module for coding assistance): DlinkedListTemplate.java Output: The elements of the list are: AI Amy Beth Bob Carol import java.util.*; public class LinkListAddRemove Template{ public static void main(String args[]){ 1/Adding elements to the Linked list //Removing First element //Same as list.remove(0); //Removing Last element //Iterating LinkedList //removing and element, index starts with o //Iterating LinkedList again class DLinkedList Template { private class Node { String value; // Value of a list element Node next; // Next node in the list Node prev; 1/ Previous element in the list Node (String val, Node n, Node p) Node (String val) { this(val, null, null); } public DLinkedList { public boolean isEmpty public int size) public void add(String e) public void add(int index, String e) public String toString() StringBuilder strBuilder = new StringBuilder(); public String remove(int index) public boolean remove(String element) Node pred = target.prev; // Node before the target Node succ = target.next; 1/ Node after the target public static void main(String [] args) { DLinkedList 1l = new DLinkedList(); 11.add("Amy"); 11.add("Bob"); 11.add(@, "Al"); 11.add(2, "Beth"); 11.add(4, "Carol"); System.out.println("The elements of the list are:"); System.out.println(11); }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!