Linked List

It is a common data structure found in all programming languages. A Linked List is very similar to a normal array in Javascript, it just acts a little bit differently.

Here each element in the list is a separate object containing a link or a pointer to the next. There is no built-in method or function for Linked Lists in Javascript so one has to implement it. An example of a linked list is shown below.

["one", "two", "three", "four"]

Types of Linked Lists

There are three different types of linked lists:

  1. Singly Linked Lists: Each node contains only one pointer to the next node.
  2. Doubly Linked Lists: There are two pointers at each node, one to the next node and one to the previous node.
  3. Circular Linked Lists: A circular linked list forms a loop by having the last node pointing to the first node or any other node before it.

results matching ""

    No results matching ""