Linked Lists

1. What is a Linked List?

A Linked list is a linear collection of data elements, called nodes, each pointing to the next node (and previous node in case of Doubly Linked List) by means of a pointer.

Node is an object which contains data fields and a reference, generally called next, of Node type, to hold the reference to the next node.

 

In case of doubly linked lists, there is another reference, called previous, to hold the reference to the previous node.

*Only fields are shown for brevity.

2. Advantages

  1. Linked Lists can be expanded at run-time.
  2. Compared to arrays, insertion/deletion is much easier as there is no need to shift items to make room for the new one.

3. Disadvantages

Access time is high for Linked Lists, so if you intend to do a lot of searching operations in your data then it is probably not the best data structure to use.

4. Types of Linked Lists

  1. Singly Linked List

  2. Doubly Linked List (WIP)

  3. Circular Linked List  (WIP)

5. Problems on Linked Lists

  1. Finding loop

  2. Finding intersection

  3. Finding middle Node (WIP)

  4. Palindrome (WIP)

  5. Reversing a list

 

This section on Linked List is a work in progress. So, check back later for updates or you can consider subscribing using the action bar at the bottom of the page to get the latest updates directly in your mail-box.

In case, you want anything else added in Linked Lists, do let me know via the comments section.

Happy Learning!!