USING JAVA AND CIRCULAR LINKEDLIST PLEASE IMPLEMENT THE METHODS IN CLL

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

USING JAVA AND CIRCULAR LINKEDLIST PLEASE IMPLEMENT THE METHODS IN CLL

Post by answerhappygod »

USING JAVA AND CIRCULAR LINKEDLIST PLEASE IMPLEMENT THE METHODSIN CLL
Using Java And Circular Linkedlist Please Implement The Methods In Cll 1
Using Java And Circular Linkedlist Please Implement The Methods In Cll 1 (41.84 KiB) Viewed 37 times
Using Java And Circular Linkedlist Please Implement The Methods In Cll 2
Using Java And Circular Linkedlist Please Implement The Methods In Cll 2 (25.41 KiB) Viewed 37 times
In the CircularLinkedList (CLL) class, using only the attribute of instance positionNow that contains the element of the current position of the CLL. Reminder: A CLL is a sequence of elements without start or end, if the CLL is empty the element at positionNow is null. We can change the element at positionNow by moving and browsing left and right in the CLL. A CLL does not have hull or twin elements (no need to check for twin elements) public class CLL<T> { } private CircularNode<T> position Now public CLL() { } = null; //Return true if the element 'element' is inside the CLL without modifying anything. //Return false otherwise //Hint: Use the method equals for this. public boolean isInside(T element) { } //Change the element in positionNow to the new element given as parameter IF that new element //already exists in the CLL, else remain the same. //Hint : use the method equals to examine the existence of the given element. public void changeIfExists (T element) { } //Remove the element at position Now, the new element at position Now becomes the element that //was to the left in the CLL of the newly removed element or becomes null if the CLL only had //one element before the remove. public T remove() { } //Insert 'element' in the CLL, to the right of the element at position Now our current position) //Our new element in position Now becomes the inserted 'element' //IF the CLL is empty before the insertion, the inserted element becomes our positionNow //IF the 'element' is null or already exists in the CLL, it is not inserted and our current //CLL does not change. public boolean insert (T element) { }
// @param <T> the generic type of the element of this list public class CircularNode <T> { } private T element; private CircularNode<T> left; //the element to the left of this link private CircularNode<T> right; //the element to the right of this link public CircularNode (T element) { this (element, null, null); } public CircularNode (T element, CircularNode<T> left, CircularNode<T> right) { element; } } this.element this.left= left; this.right = right; public T getElement() { return element; } public void setElement(T element) { this.element = element; } public CircularNode<T> getLeft() { return left; } public void setLeft (CircularNode<T> left) { this.left= left; } public CircularNode<T> getRight() { return right; } = public void setRight (CircularNode<T> right) { this.right right; =
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply