Data Structures

A data structure is a particular way of organizing data in a computer so that it can be used effectively.
Try to avoid from envisioning data structures as drawings. It will make it more difficult to use complex data structures and implementation of algorithms.

There are types of data structures:

Linear Data Structures

A linear data structure is one where data items are arragend in a linear fashion.
Each member is attached to its neighboring elements.

Array

Array is a data structure used to store elements at contiguous locations.
Size of an array must be provided before storing data.

When To Use :

Matrix

A matrix represents a collection of numbers arranged in an order of rows and columns.
It is necessary to enclose the elements of a matrix in parentheses or brackets.

When to use:

Linked List

A linked list is a linear data structure (like arrays) where each element is a separate object.
Each element (that is a node) of a list is comprising of two items – the data and a reference to the next node.

There are multiple types of linked list :

Methods:

When to use:

Stack

A stack or LIFO (last in, first out) is an abstract data type that serves as a collection of elements, with two principal operations: push, which adds an element to the collection, and pop, which removes the last element that was added.

In stack both the operations of push and pop takes place at the same end that is top of the stack.

It can be implemented by using both array and linked list.

Methods :

When to use:

Queue

A queue or FIFO (first in, first out) is an abstract data type that serves as a collection of elements, with two principal operations: enqueue, the process of adding an element to the collection (The element is added from the rear side) and dequeue, the process of removing the first element that was added. (The element is removed from the front side).

It can be implemented by using both array and linked list.

Methods :

When to use:

Double-ended queue is abstract data type that generalizes a queue, for which elements can be added to or removed from either the front or back.

Hierarchical Data Structures

Hierarchical data is a data structure when items are linked to each other in parent-child relationships in an overall tree structure.

Binary Tree

Data structure in which each node has at most two children, which are referred to as the left child and the right child.

A tree is represented by a pointer to the topmost node in tree. If the tree is empty, then value of root is NULL.

A Binary Tree node contains following parts:

A Binary Tree can be traversed in several ways:

In Binary Search Tree is a Binary Tree with following additional properties:

A Binary Heap is a Binary Tree with following properties:

When to use:

Graph

A Graph is a non-linear data structure consisting of nodes and edges.
The nodes are sometimes also referred to as vertices and the edges are lines or arcs that connect any two nodes in the graph.

A Graph consists of a finite set of vertices(or nodes) and set of Edges which connect a pair of nodes.
It is good with OSPF (open shortest path first) algorithm .

When To Use :

Additional links:

Hash Table

Data structure which stores data in an associative manner.
In a hash table, data is stored in an array format, where each data value has its own unique index value.
Access of data becomes very fast if we know the index of the desired data.
Thus, it becomes a data structure in which insertion and search operations are very fast irrespective of the size of the data.

Hash Table uses an array as a storage medium and uses hash technique to generate an index where an element is to be inserted or is to be located from.
Hashing is a technique to convert a range of key values into a range of indexes of an array (for example, use modulo or by last characters in strings).

Methods :

When to use:

Up Next

The next step is about understanding the different development types. Whether you are interested in web development, game development, mobile app development, or any other specialization, this step will introduce you to the unique considerations and tools associated with each domain.