A linked list is a linear data structure, in which the elements are not stored at contiguous memory locations. The elements in a linked list are linked using pointers as shown in the image above.
In simple terms, a linked list consists of nodes where each node contains a data field and a reference to the next node in the list. the linked list is way different from the array data structures because in linked list the list only knows about the head and tail node while each element only knows about the next element after them.
Implementation of LinkedList in Javascript
We are going to implement append: to add values at the end of the list, prepend: to add values at the beginning of the list, find value: to search the list for a particular value, delete: to remove a value from the list, insert after: to insert a value just after a specified value, print values: to view all the values of the linked list.
insert after and print all values
thanks for your time, I have more post liked this to help you understand data structures, please keep checking.
Top comments (0)