It’s a physical implementation that clearly defines a way of storing, accessing
and manipulating data.
Data Structure
Types of D.S.
1. Simple Data Structures are built from primitive data types like integers,
characters, booleans.
e.g. : Arrays & Lists
2. Compound Data Structures are made by combining simple data
structures in different ways.
Linear Data Structures Non Linear Data Structures
i. Tree
ii. Graph
iii. etc.
i. Stack
ii. Queue
iii. Linked List
Linear List Arrays
Arrays refer to a named list of a finite number n of same type of elements.
Arrays can be one dimensional, two-dimensional or multi-dimensional.
0 1 2 3 4 5
8 0 1 3 4 2
Stacks
Last In First Out
Insertion & Deletion both
takes place at the top.
There’s a special way to store lists where we use LIFO technique.
Linked List
As the name suggests, it’s a list like implementation where elements are
linked.
DATA DATA
Stores the value stores the address of next node
12&
120
49&
haus
bbcc
N
U
L
L
Trees are multilevel data structures having a hierarchical relationship
among its elements.
In a linked list, each node stores data & address of next node.
In a Tree, each node stores data & address(es) of child node(s).
Trees
4
5
2
1
2
1
1. Insertion means adding new data element.
2. Deletion means deleting some data element.
3. Searching means finding(maybe index) of some data.
4. Traversal means walking in all elements.
5. Sorting means arranging elements in some order.
6. Merging means combining similar DS.
Operations on DS DS
Stacks
Last In First Out
Insertion & Deletion both
takes place at the top.
There’s a special way to store lists where we use LIFO technique.
Stacks
5
4
5
7
4
5
4
5
8
4
5
13
8
4
5
13
8
4
5
S S S S S S S
8
4
5
8
4
5
4
5 5
S S S S
Stacks
13
8
4
5
3
13
8
4
5
3
13
8
4
5
13
8
4
5
8
4
5
4
5 5
S S S S S S S S S
To implement a stack we need to make its functions.
1. isEmpty(s)
2. Push(s,i)
3. Pop(s)
4. Peek(s)
5. Display(s)
Implementing Stack
‘Ghantu’
‘Mintu’
‘Pintu’
‘Chintu’
We need to maintain top of stack, and make it None when stack is empty.
STACK IMPLEMENT CODE

17. DS, Stacks Types of DS.pdf

  • 2.
    It’s a physicalimplementation that clearly defines a way of storing, accessing and manipulating data. Data Structure
  • 3.
    Types of D.S. 1.Simple Data Structures are built from primitive data types like integers, characters, booleans. e.g. : Arrays & Lists 2. Compound Data Structures are made by combining simple data structures in different ways. Linear Data Structures Non Linear Data Structures i. Tree ii. Graph iii. etc. i. Stack ii. Queue iii. Linked List
  • 4.
    Linear List Arrays Arraysrefer to a named list of a finite number n of same type of elements. Arrays can be one dimensional, two-dimensional or multi-dimensional. 0 1 2 3 4 5 8 0 1 3 4 2
  • 5.
    Stacks Last In FirstOut Insertion & Deletion both takes place at the top. There’s a special way to store lists where we use LIFO technique.
  • 6.
    Linked List As thename suggests, it’s a list like implementation where elements are linked. DATA DATA Stores the value stores the address of next node 12& 120 49& haus bbcc N U L L
  • 7.
    Trees are multileveldata structures having a hierarchical relationship among its elements. In a linked list, each node stores data & address of next node. In a Tree, each node stores data & address(es) of child node(s). Trees 4 5 2 1 2 1
  • 8.
    1. Insertion meansadding new data element. 2. Deletion means deleting some data element. 3. Searching means finding(maybe index) of some data. 4. Traversal means walking in all elements. 5. Sorting means arranging elements in some order. 6. Merging means combining similar DS. Operations on DS DS
  • 9.
    Stacks Last In FirstOut Insertion & Deletion both takes place at the top. There’s a special way to store lists where we use LIFO technique.
  • 10.
  • 11.
  • 12.
    To implement astack we need to make its functions. 1. isEmpty(s) 2. Push(s,i) 3. Pop(s) 4. Peek(s) 5. Display(s) Implementing Stack ‘Ghantu’ ‘Mintu’ ‘Pintu’ ‘Chintu’ We need to maintain top of stack, and make it None when stack is empty.
  • 13.