Data structure

Data structure

Data structure

As discussed, A data structure is a way of organizing data in a computer so that it can be used effectively. Types of data structure

  1. Linear data structure
  2. Non-linear data structure

Let’s discuss the different types of data structures one by one:

Array:  Array is the way of storing the homogeneous data elements at a contiguous location. In an array, data can be retrieved from any position. Each element within the array is accessed using the index.

Arrays are finite in size, which means we have to define their length/size at the time of declaration of the array. but with the concept of ‘dynamic resizing of an array to allow for more elements to be added to it or for reducing the size of the array.

Example:

Linked List: Linked list is a type of data structure where elements are stored in the node. Node is the structure consisting of the data element and address of the next node which consists of the next data. The elements in a linked list are linked using pointers.


Linear Linked List

Types of Linked List:

  1. Singly Linked List: In this type of Linked List, every node stores the reference of the next node, and the last node stores the NULL value.
  2. Doubly Linked List: In Doubly Linked List, nodes can be accessed in both directions. Nodes consist of data, reference of the next node, and the reference of the previous node. 

Circular Linked List: In a circular Linked List, nodes are connected circularly. There is no NULL value. A circular linked list can be a Singly Linked List or doubly linked list.