Question: java Lab 4: Circular Linked-List Objective(s) 1- Create Circular Linked-List in Java. 2-Deal with Circular Linked-List in case of: insertion, Deletion, searching. Tool(s)/Software Java programming

java
java Lab 4: Circular Linked-List Objective(s) 1- Create Circular Linked-List in Java.
2-Deal with Circular Linked-List in case of: insertion, Deletion, searching. Tool(s)/Software Java
programming language with NetBeans IDE. Description: Tail Node 1 Node 2 Node
3 tem Null Linear linked list Tall Node 1 Node 2 Node

Lab 4: Circular Linked-List Objective(s) 1- Create Circular Linked-List in Java. 2-Deal with Circular Linked-List in case of: insertion, Deletion, searching. Tool(s)/Software Java programming language with NetBeans IDE. Description: Tail Node 1 Node 2 Node 3 tem Null Linear linked list Tall Node 1 Node 2 Node 3 mom Hem Hum Circular linked list Singly Circular Linked List: It is just like the singly/linear linked list where tail node holds the address of head node so traversal can be done circular in only one direction. A. How to Create Circular Linked-List in Java: There are 3-steps approach to create Circular Linked-List in Java Step 1: Declare class for the Node - forming the structure of the node private static class Node private elementi private Node next; public Node (E e, Node n) { this.element - e; this.next - ni > public EgetElement() { return this.element; > public Node getNext() { return this.next; public void setNext (Node n) { this.next=n; Step 2: Declare the CircularLinkedList class that includes the Node class. CODE public CM CircularlinkedList private class Node ...26 lines sodo hod null; Node tail null; int size = 0; public Circularlinkedint() () /A Moda public int size() ... lines public boolean isEmpty() 1...3 lines public int first() 1 ... 3 lincs public int last() ...3 lines public void display ...14 Lion \/update Method public void addFirst (int value) 1... 15 lines public void addLast(int value) 1...14 lines public void addAt Pos(int pos, int value) 1...16 Display method in CircularLinkedList class: public void display() { if (isempty()) System.out.println("Empty list.."); Node current - head; int i = 1; do System.out.printin ("Node+ (i++)+": current = current.getNext(): 1 while (current != head); + current.getData()): Step 3: Define the object of CircularLinkedList class: CircularLinkedList myList=new CircularLinkedList (); myList.addFirst (10); myList.addFirst (20); myList.addFirst ( 30 ); myList.addFirst ( 40 ); B. Circular Linked-List Operations: 1. Traversing Circular Linked-List 2. Searching in Circular Linked-List 3. Insertion in Circular Linked-List 4. Deletion from Circular Linked-List Note: Please refer to lecture slides for the algorithms. Tasks/Assignments(s) 1. Create CircularLinkedList class. Apply all the following operations: Adition: addFirst, addLast, addAtPoistion Deletion: removeFirst, removeNode. FindNode: to find a node with specific given value. 2. Add a method rotate() to CircularLinkedList class that shift the list one node, below is the output before and after calling the method. Node 2:38 Node 3:20 Node 4 :10 run: | Display List: Node 1:40 The list is shifted Display List: Node 1:30 First element: 30 Last element: 40 Node 2:20 Node 3 :10 Node 4:40 Deliverables(s) You are required to implement and deliver a Java program as described in the previous

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!