Data Structures

  • Home
  • Data Structures
Shape Image One

DATA STRUCTURES

advanced divider

DATA STRUCTURES:

Data structure is a particular means of organizing and storing data in computers in such a
way that we can perform operations on the stored data more efficiently. Data structures
have a wide and diverse scope of usage across the fields of Computer Science and Software
engineering. Data structure may be linear or non-linear.

LINEAR DATA STRUCTURE:

Linear data structure arranges the data in a linear fashion. The data elements are arranged sequentially such that the element is directly linked to its previous and the next elements. This data structure supports single-level storage of data. And hence, transfer of the data is achieved through a single run only. Examples of linear data structures are Stack, Queue, Array, etc.

STACK:

Stack is a linear data structure that stores information in such a way that the last item stored is the first item retrieved. It is based on the principle of LIFO (Last-in-first-out). The stack in digital computers is a group of memory locations with a register that holds the address of top of element. Stacks usually performs two operations.
Push: It is used to insert an element on top of stack.
Pop: It is used to delete an element from top of stack.

QUEUE:

Queue is the type of linear data structure where the elements to be stored follow the rule of First in First Out (FIFO). In queue, the element that was added first is removed first) In this data structure, both ends are used for the insertion and the removal of data. The two main operations of queue are enqueue and dequeue.

ENQUEUE:

It refers to the process where inserting an element is allowed to the collection
of data.

DEQUEUE:

It refers to the process where removal of elements is allowed, which
element of queue.

ARRAY:

The array is the type of linear data structure that stores homogeneous (same type) elements at memory locations which are consecutive. The same types of objects are stored sequentially in an array. The main idea of an array is that multiple data of the same type can be stored together. Before storing the data in an array, the size of the array has to be defined. The location of elements stored in an array has a numerical value called index to identify the element. Some operations of array are:
Traverse: Go through the elements and print them.
Search: Search for an element in the array by its value or its index.
Update: Update the value of an existing element at a given index.
Insert: Insert an element in array.
Deletion: Delete an element from array.
Sorting: Rearrange a given array or list of elements.

NON-LINEAR DATA STRUCTURES:

Non-linear data structures are those data structures in which data items are not arranged in a sequence. In this structure, each element can have multiple paths to connect to other elements. Non-linear data structures allow multi-level storage. Non-linear data structures are not easy to implement but are more efficient in utilizing computer memory. Examples of non-linear data structures are Tree, Graphs, etc.

TREE:

A tree can be defined as a finite set of data items (nodes) in which data items are arranged in branches and sub-branches. It consists of various linked nodes and has a hierarchical tree structure that forms a parent-child relationship. In tree structure, the first node is called root node. The node connected to root node are called parent node and another node connected to parent node is called child node. Various types of trees have been developed throughout the past decades, one of them are binary tree or binary search tree.

GRAPH:

Graphs are used to solve many real-life problems. A graph is a non-linear data structure that has a finite number of vertices and edges, and these edges are used to connect the vertices. The vertices are used to store the data elements, while the edges represent the relationship between the vertices. The order of a graph is the number of vertices in the graph. The size of a graph is the number of edges in the graph.
There are two types of graphs:

(a) Undirected graph

(b) Directed graph

UNDIRECTED GRAPH:

An undirected graph is a graph in which all its edges have no direction. It can go in both ways between the two vertices.

DIRECTED GRAPH:

A directed graph is a graph in which all its edges have a direction indicating what is the start vertex and what is the end vertex.

Quiz

advanced divider