Challenge Problem :
- insertNodeAtTail - adds a node to the tail of a linked list.
- deleteNode - delets a node from the linked list and updates the list.
This post is the pre-requisite for the following examples.
- Remove duplicates from an unsorted linked list
- Find the kth to last element of a singly linked list
- Partition a linked list around a value
- Reverse a singly linked list
- Given a singly linked list find if it is palindrome
ES6 version of the solution
Non-ES6 version of the solution
- Dynamic data structure, can create new nodes while the program is running.
- Insertion and deletion node operations are easily implemented.
- Linear data structures such as stacks and queues are easily executed with a linked list.
- They can reduce access time and may expand in real time without memory overhead.
- They have a tendency to use more memory due to extra property
nextto point to the next node.
- Nodes in a linked list must be read in order from the beginning as linked lists are inherently sequential access.
- Difficulties arise in linked lists when it comes to reverse traversing. For instance, singly linked lists are cumbersome to navigate backwards and while doubly linked lists are somewhat easier to read, memory is wasted in allocating space for a property