MCS021 Data and File Structure
MCS021 Data and File Structure
Block 1 INTRODUCTION TO
ALGORITHMS AND DATA STRUCTURES
UNIT 1 Analysis of Algorithms
UNIT 1 Analysis of Algorithms
1. Mathematical Background
2. Process of Analysis
3. Calculation of Storage
Complexity
4. Calculation of Time Complexity
Mathematical background
Definition of algorithm
Complexity classes
Asymptotic Analysis
Asymptotic notation
Asymptotic notation
Question :- f(n) = 3n3 + 2n 2 + 4n + 3
Like
Share
Comment
Subscribe
Process of Analysis
Process of Analysis
Calculation of storage complexity
Calculation of storage complexity
Calculation of storage complexity
Like
Share
Comment
Subscribe
Calculation of Time complexity
Calculation of Time complexity
The complexity Ladder:
1. T(n) = O(1). This is called constant growth.
2. T(n) = O(log2 (n)). This is called logarithmic growth.
3. T(n) = O(n). This is called linear growth.
4. T(n) = O(n log (n). This is called nlogn growth.
5. T(n) = O(nk ). This is called polynomial growth.
6. T(n) = O(2n ) This is called exponential growth
Calculation of Time complexity
The growth patterns above have been listed in order
of increasing size :-
O(1) < O(log(n)) < O(n log(n)) < O(n2
) < O(n3 ), ... , O(2n ).
Comparison of various algorithms and their complexities
Comparison of typical running time of algorithms of different
orders
MCS-021(Data and File Structure)
Block 1 INTRODUCTION TO
ALGORITHMS AND DATA STRUCTURES
UNIT 2 Arrays
UNIT 2 Arrays
1. Arrays and Pointers
2. Sparse Matrices
3. Polynomials
4. Representation of Arrays
5. Applications
Arrays and pointers
• HOMOGENEOUS TYPE OF ELEMENT
• CONTIGUOUS ELEMENT
Character arrays
Arrays and Address
1- D arrays
2- D arrays
Like
Share
Comment
Subscribe
Sparse matrices
Matrices with good number of zero entries are called sparse matrices.
Sparse matrices
Sparse matrices
Sparse matrices
Sparse matrices
Like
Share
Comment
Subscribe
Polynomials
REPRESENTATION OF ARRAYS
REPRESENTATION OF ARRAYS
1. Row Major Representation
2. Column Major
Representation
Row major Representation
Column major Representation
Application of array
MCS-021(Data and File Structure)
Block 1 INTRODUCTION TO
ALGORITHMS AND DATA STRUCTURES
UNIT 3 LISTS
UNIT 3 Lists
1. Abstract Data Type-List
2. Array Implementation of Lists
3. Linked Lists-Implementation
4. Doubly Linked Lists-Implementation
5. Circularly Linked Lists-Implementation
Abstract Data Type – List
• Abstract Data Type (ADT) is a useful tool for
specifying the logical properties of data type.
Abstract Data Type – List
Like
Share
Comment
Subscribe
Array implementation of lists
Insertion
• If we want to add element ‘35’ after element ‘33’. We have to shift 77
to 8th position, 66 to 7th position, so on, 44 to 5th position.
Deletion
If we want to delete an element ‘44’ from list. We have to shift 55 to 4th
position, 66 to 5th position, 77 to 6th position.
Like
Share
Comment
Subscribe
Linked Lists – implementation
The Linked list is a chain of structures in which each structure consists of
data as well as pointer, which stores the address (link) of the next logical
structure in the list.
Linked Lists – implementation
Insertion in Linked Lists
Insertion in Linked Lists
A node can be added in three ways
• At the front of the linked list
• After a given node.
• At the end of the linked list.
Deletion in Linked Lists
Like
Share
Comment
Subscribe
Doubly Linked Lists –implementation