Let us see a few problems based on Linked List. Given a linked list of N nodes such that it may contain a loop. A loop here means that the last node of the link list is connected to the node at position X(1-based index). If the link list does not have any loop, X=0. Remove the […]
May 14, 2023 | Data Structure | No comments
What is a Linked List? A linked list is a linear data structure composed of nodes, each of which holds a value and a reference (or pointer) to the next node in the list. The first node is referred to as the list’s head, while the last node is referred to as the list’s tail. […]
May 14, 2023 | Data Structure | No comments
The Queue interface extends the Collection interface and is present in java.util package is used to hold the elements about to be processed in FIFO (First In First Out) order. It is an ordered list of objects that can only be used to insert elements at the end of the list and delete elements from […]
September 16, 2022 | Java | No comments
The Java Collection Framework includes the AbstractSequential List class, which implements the Collection interface, and the AbstractCollection class. It is used to implement an unmodifiable list, for which one needs to only extend this AbstractList Class and implement only the get() and the size() methods. AbstractSequential List Method: Method Description add(int index, E element) Inserts […]
September 9, 2022 | Java | No comments
This class provides a skeletal implementation of the List interface in order to reduce the effort required to implement this interface in combination with a “random access” data store (such as an array). Abstract List should be used instead of this class for sequential access data (such as a linked list). Declaration: Methods of Abstract […]
September 9, 2022 | Java | No comments