Linked List

Linked List
A singly linked list is a data structure having a list of elements where each element has a reference pointing to the next element in the list. Its elements are generally referred to as nodes; each node has a data field containing a data value and a next field pointing to the next element in the list (or null if it is the last element in the list). The diagram below depicts a linked list of length 3:


The sample code below demonstrates how to create a LinkedList of Strings, and some of the operations that can be performed on it.

The above code produces the following output:

Leave a Reply

Your email address will not be published. Required fields are marked *