Introduction To Data Structures - ARRAY
Introduction To Data Structures - ARRAY
II YEAR
A data structure is a storage that is used to store and organize data.
It is a way of arranging data on a computer so that it can be accessed
and updated efficiently.
A data structure is not only used for organizing the data. It is also
used for processing, retrieving, and storing data
Types of Data Structure
CHOCOLATE
Elements Index
Array name
0
49
Sample code:
1 0
int boxer[50]; 13 1
23 2
boxer[0] = 1; 4
boxer[1]=13; 5
boxer[2]=23; .
49
Abstract Data Type (ADT):
An Abstract Data Type (ADT) is a theoretical concept in data structures that defines
a data type by its behavior (operations) from the point of view of a user, without
specifying the implementation details.
It focuses on:
What operations can be performed on the data.
What outcomes to expect from those operations.
It does NOT describe how the operations are implemented.
Think of a TV remote:
You know what the buttons do (volume up, change channel, etc.)
But you don’t know (or need to know) how the circuit inside works.
Similarly, an ADT defines what operations are allowed, but hides how they are
done
LINKED LIST
Linked List is a very commonly used linear data structure
which consists of group of nodes in a sequence.
Each node holds its own data and the address of the next
node hence forming a chain like structure.
Linked Lists are used to create trees and graphs.
LINKED LIST
Nodes are connected(Linked) with next node and to the next node.
LINKED LIST
NODE
INT NEXT
STRING DATA ADDRESS NODE IN
CLASS LIST
(It will show the next node
memory location)
LINKED LIST
HEAD
NODE
a b
The last node will be called as an Tail node
NULL
SINGLY LINKED LIST
Singly linked lists contain nodes which have a data part as well
as an address part i.e. next, which points to the next node in the
sequence of nodes.
The operations we can perform on singly linked lists are
insertion, deletion and traversal
SINGLY LINKED LIST
struct Node {
int data;
struct Node* next;
};
DOUBLY LINKED LIST
In a doubly linked list, each node contains a data part and
two addresses, one for the previous node and one for the next
node.
DOUBLY LINKED LIST
struct Node {
int data;
struct Node* next;
struct Node* prev;
};
CIRCULAR LINKED LIST
In circular linked list the last node of the list holds the address
of the first node hence forming a circular chain.
DIFFERENCE BETWEEN ARRAY AND LINKED LIST
Array Linked list
Arrays is static data structure means its size can't be increased Linked list is dynamic data structure means its size can be
or decreased on runtime modified on runtime
In arrays, insertion and deletion consequences as large In linked list, insertion and deletion doesn't need so much
amount of data movements data movements
Polynomial manipulation:
Polynomial manipulation is a fundamental application of data structures,
commonly used in symbolic computation systems. It involves performing
operations like addition, subtraction, multiplication, and evaluation of
polynomials.
/
INFIX TO PREFIX AB/C+
+/ABC
+
OUTPUT
STACK
A/B+C → INFIX INFIX TO POSTFX
A * B + ( C- D / E ) #
INFIX TO POSTFIX
AB/C+
INFIX TO PREFIX
+/ABC