0% found this document useful (0 votes)
37 views6 pages

DATA STRUCTURE Notes

A data structure organizes data to facilitate storage and retrieval. There are linear structures like arrays, stacks, and queues that arrange elements in one dimension, and non-linear structures like trees and graphs that arrange elements in multiple dimensions. Common data structures include arrays, linked lists, stacks, queues, trees, and graphs, which are used in applications such as operating systems, databases, and machine learning.

Uploaded by

KARTIK CO21333
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0% found this document useful (0 votes)
37 views6 pages

DATA STRUCTURE Notes

A data structure organizes data to facilitate storage and retrieval. There are linear structures like arrays, stacks, and queues that arrange elements in one dimension, and non-linear structures like trees and graphs that arrange elements in multiple dimensions. Common data structures include arrays, linked lists, stacks, queues, trees, and graphs, which are used in applications such as operating systems, databases, and machine learning.

Uploaded by

KARTIK CO21333
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 6

DATA STRUCTURE

A data structure is a group of data elements that provides the easiest way to
store and perform different actions on the data of the computer. A data
structure is a particular way of organizing data in a computer so that it can be
used effectively. The idea is to reduce the space and time complexities of
different tasks. Data structures are used in various fields such as: Operating
system, Graphics, Computer Design, Blockchain,etc.

Type of data structure :


1.     Linear Data Structure
2.     Non-Linear Data Structure.
  Linear Data Structure:
  Elements are arranged in one dimension .also known as linear
dimension.
  Example: lists, stack, queue, etc.
   Non-Linear Data Structure
   Elements are arranged in one-many, many-one, many-many
dimensions.
  Example: tree, graph, table, etc.

1. Array: An array is a collection of data items stored at contiguous
memory locations. The idea is to store multiple items of the same type
together.
Different applications of Array is as follow:
 Array is used in solving matrices problem
 Databases record are also implemented by array.
 It is also used to  Implement other data structures like Stacks,
Queues, Heaps, Hash tables, etc.
 Array can be used for CPU scheduling.
 It is used in image processing.
 It is also used in record management.
 Book pages is also real life example of array.

2. Linked Lists: Like arrays, Linked List is a linear data structure. Unlike


arrays, linked list elements are not stored at a contiguous location; the
elements are linked using pointers. Types of Linked List:
 Singly linked list
 Doubly linked list

 Circular linked list

 Doubly circular linked list

Different applications of Linked List is as follow:


 Linked lists are used to implement stacks, queues, graphs, etc.
 Linked list uses to perform arithmetic operations on long integers.
 It is used for representation of sparse matrices.
 It linked allocation of files.
 It is used in image viewer. Previous and the next images are linked,
hence can be accessed by next and previous button.
 In Music playlist songs are linked to previous and next song. 

3. .Stack: Stack is a linear data structure which follows a particular order


in which the operations are performed. The order may be LIFO(Last In
First Out) or FILO(First In Last Out). In stack, all insertion and deletion
are permitted at only one end of the list.
Basic operations are performed in the stack: 
 Initialize: Make a stack empty.
 Push: Adds an item in the stack. If the stack is full, then it is said to
be an Overflow condition.
 Pop: Removes an item from the stack. The items are popped in the
reversed order in which they are pushed. If the stack is empty, then it
is said to be an Underflow condition.
 Top: Returns top element of the stack.
 isEmpty: Returns true if the stack is empty, else false.
Different applications of Stack is as follow:
 Stack Data structure is used in evaluation and conversion of
Arithmetic expression.
 Stack is used in Recursion.
 It is used for parenthesis Checker.
 While Reversing of String stack is also used.
 Stack is used in memory management.
 Browsers uses stack data structure to keep track of previously visited
sites.
 Call log in mobile also uses stack data structure. 

4. Queue: Like Stack, Queue is a linear structure which follows a


particular order in which the operations are performed. The order is First
In First Out (FIFO). In the queue, items are inserted at one end and
deleted from the other end. Queue can also be defined as the list or
collection in which the insertion is done from one end known as the rear
end or the tail of the queue, whereas the deletion is done from another
end known as the front end or the head of the queue.
basic operations are performed on queue: 
 
Enqueue: Adds an item to the queue. If the queue is full, then it is said
to be an Overflow condition. The Enqueue operation is used to insert the
element at the rear end of the queue.
Dequeue: Removes an item from the queue. The items are popped in the
same order in which they are pushed. If the queue is empty, then it is
said to be an Underflow condition. It performs the deletion from the
front-end of the queue. It also returns the element which has been
removed from the front-end. It returns an integer value.
Front: Get the front item from the queue.
Rear: Get the last item from the queue.
Peek: This is the third operation that returns the element, which is pointed
by the front pointer in the queue but does not delete it.

Types of queue
Simple Queue or Linear Queue

Circular Queue

Priority Queue
Deque (or, Double Ended Queue)

Different applications of Queue is as follow:


 Queue is used for handling website traffic.
 It helps to maintaining the playlist in media players.
 Queue are used in operating systems for handling interrupts.
 A real world example of queue is single lane one way road, where the
vehicle enters first will exit first. 
 More real word example can be seen as queue at the ticket windows.

5. Binary Tree: Unlike Arrays, Linked Lists, Stack and queues, which are
linear data structures, trees are hierarchical data structures. A binary tree
is a tree data structure in which each node has at most two children,
which are referred to as the left child and the right child. It is
implemented mainly using Links. A Binary Tree is represented by a
pointer to the topmost node in the tree. If the tree is empty, then the
value of root is NULL. A Binary Tree node contains the following parts
Data, Pointer to left child and Pointer to the right child.
Different applications of Tree is as follow:
 Heap is a tree data structure which is implemented using arrays, and
used to implement priority queues.
 B-Tree and B+ Tree is used to implement indexing in databases.
 In real life tree data structure helps in Game Development. 
 Also it helps in indexing of database. 
 Decision trees is efficient machine learning tool, commonly used in
decision analysis. 
 Tree helps to understand the data using flow chart.
6. Graph:

Graph is a non-linear data structure that consists of nodes and edges. A


graph consists of finite sets of vertices and sets of Edges that connect a
pair of nodes. The graph is used to solve the most challenging and
complex programming problems. 
Different applications of Graph are as follows:
 Graph is used to represent the flow of computation.
 It is used in modeling graphs.
 Operating system uses Resource Allocation Graph.
 One of the most real-world examples of a graph is Google map where
cities are located as vertices and path is located as edges of the graph.
 Social Network is also one real-world example of graph where every
person on the network is a node, and all the friendships on Instagram
form the edges of the graph.

You might also like