November 2, 2020
If you want to remove an item from the linked list in Java by key, you should follow several steps. The fundamental idea to do with the pointers: the front pointer and the back pointer. Set the minimum interval between them, which is one element. Move both of them with the help of the “while […]
November 2, 2020
If you want to insert an item in the sorted linked list in Java, you should follow several steps. This solution works if we work with the sorted linked list. The fundamental idea to do with the pointers: the front pointer and the back pointer. Set the minimum interval between them, which is one element. […]
November 2, 2020
If you want to remove duplicates from the sorted linked list in Java, you should follow several steps. This solution works only if the linked list is sorted. The fundamental idea is to start the while loop until the next element is null. Compare the current element with the next one. If the values are […]
October 31, 2020
One of the common questions on the technical interview is to find the nth element from the last in the linked list in Java. To solve this problem, you should use the pointers’ technique. We should set two-pointers and set a needed distance between them. After that, we should move both of them until the […]
October 30, 2020
There is a straightforward way to find the middle element of the linked list java. Since it is one of the common questions on any technical interview, it is good to know the elegant solution. It will work just if you have implemented the linked list with the constructor and model class’s help. If you […]
October 29, 2020
There are two ways to reverse a linked list in Java. Iterative and recursive. I will explain the iterative method of implementation. We will go through the example and present in the details each step of the process. If you want to know how to create the link list follow this page. The main principle […]
October 28, 2020
In case you want to find an element in the Linked List in Java, there is an easy way to do so. That way of the implementation works if you have implemented the linked list with the constructor and the model class’s help. I have explained the details of implementing the linked list in this […]
October 24, 2020
Remove an item from the Linked List by using object of collections in Java, you may call several methods: Remove element by value 2. Remove first element in the Linked List 3. Remove last element in the Linked List Removing the element from Linked List in Java without collections. If you are using your implementation […]
October 23, 2020
In this article, you will know how to add item to the linked list java. If you are using the LinkedList type taken from the Java collections, you have several options: Adding the element at the beginning of the Linked List 2. Adding the element at the end of the Linked List 3. Adding the […]
October 23, 2020
If you want to find the Linked List length on an example of Java, you may follow two ways.It depends on what way of implementation you used. Firstly, you implement the LinkedList with the help of Java collections. On the other way, you may implement Linked List by creating your model and constructor. For more […]