Skip to main content
data-structure-logo

Linked List – Data Structure

Overview

Singly Linked List is a linear data structure. In a Linked List each node in the list stores data and reference to the next node.

 

linked list

Array Vs Linked List

Arrays also can be used to store linear data. But compare with the Linked List, Arrays have some limitations.

Pros:-

  1. Arrays size is fixed. We must define the size of the array before use it. In Linked List size is dynamic. We can add data as much as we want.
  2. Insertion and Deletion are not expensive compared with the Array. In array need to be moved the elements when inserting or deleting.

Cons:-

  1. Need extra memory space for keeping a reference to next element.
  2. Random access is not allowed.

Implementation

 

Complete Example

Output: –

10->20->30->NULL


 


Related Post

18085total visits,1visits today

RSS
Follow by Email
Facebook
Facebook
Google+
http://mydevgeek.com/linked-list-data-structure
Twitter