SlideShare a Scribd company logo
1 of 35
XP
1
DATA STRUCTURE AND ALGORITHM
CHAPTER 1: INTRODUCTION
Presented By:
Er.Ganesh Ram Suwal
BE | ME Computer Engineering
Email: suwalganesh@gmail.com
Lecturer
January 2021
XP
2
INTRODUCTION
 Fact: Fact is a Universal Truth (either TRUE or FALSE). It is an
occurrence in the world. Fact is a raw data. It is collected from
questionnaires, survey or from data collection process.
 Data: It is simply a collection of fact. Data may be a single value or
a set of values. The organization of data leads to the structuring of
data.
 Information: When we
process data we get certain
knowledge and that knowledge
is known as an Information.
Data is a bit of information but
not an information itself.
Figure 1.1: Data and Information
XP
3
DATA STRUCTURE
 Data Structure is defined as it is the representation of logical
relationship existing between individual elements of data. The data
structure is a way of organizing all the data items that considers
not only the elements but also their relationship to each other.
 So data structures are the building blocks of a program. The
selection of a data structure must focuses on following two things
1. The data structure must reflects the relationship existing
between the data.
2. The data structure must be simple to process data effectively
whenever required
XP
4
DATA STRUCTURE
 Data Structure specifies four things
1. Organization of Data
2. Accessing methods
3. Degree of associativity
4. Processing for Information
 Data structure can be defined as triple {D, F, A}
 D is data
 F is set of Functions and
 A is set of axioms.
Permitted Data values + Operations = Data Type
Organized Data + Allowed Operations = Data Structure
XP
5
DATA STRUCTURE - USES
 Data Structure is extensively used in
 Database Management System (DBMS)
 Data Mining and Warehousing
 Compiler Design
 Network Analysis
 Numerical Analysis
 Artificial Intelligence
 Operating System
 Image Processing
 Computer Graphics, etc…
XP
6
DATA STRUCTURE - CLASSIFICATION
 Primitive and Non Primitive
 Primitive Data Structure
 Non Primitive Data Structure
 According to the Nature of Size
 Static Data Structure
 Dynamic Data Structure
 According to its occurrence
 Linear Data Structure
 Non Linear Data Structure
 Homogeneous and Non-Homogeneous
 Homogeneous Data Structure
 Non Homogeneous (Heterogeneous) Data Structure
XP
7
1. Primitive and Non Primitive DATA STRUCTURE
 Primitive data structure
 Primitive Data Structures are the basic data structure and they are
directly operated by a machine instructions.
 The representation of primitive data structure is different on different
computers
 character, integer, floating point numbers, strings
 Non Primitive data structure
 Non Primitive Data Structures are complex data structures that are
derived from the basic data structure
 Non-primitive data structure emphasis on structuring the homogeneous
and heterogeneous data elements
 Array, List, Files
XP
8
Primitive and Non Primitive DATA STRUCTURE
Figure 1.2: Primitive and Non Primitive Data Structure Classification
XP
9
2. According to the Nature of Size DATA STRUCTURE
 Static Data Structure
 The data structure which have a fixed data size is called static data
structure. The size cannot be vary at run time.
 An array is used in static data structure
 Char name[100] – the array size is 100 so maximum upto 100 characters
can be stored by array variable ‘name’
 Dynamic Data Structure
 The size of data structures are vary not fixed is called dynamic data
structure. It uses the concept of pointer.
 DMA (Dynamic Memory Allocation) is used in dynamic data structure.
Allocation of memory is done whenever the data required and de-
allocation of memory is done whenever the data is no more required
 The size of data structure is grow and shrink
 Int *ptr
 DMA functions malloc(), calloc(), realloc() and free() are used
XP
10
3. According to its occurrence DATA STRUCTURE
 Linear Data Structure
 In linear data structure the data elements are stored in a consecutive
memory locations or data are stored in a sequential manner.
 For example: array, stack, queue etc
 Non Linear Data Structure
 In non-linear data structure the data elements are not stored in a
consecutive memory location or non-sequential manner.
 These data structures are used to represent the hierarchical relationship
between data elements.
 For example: tree, graph etc.
XP
11
According to its occurrence DATA STRUCTURE
Figure 1.3: Linear and Non Linear Data Structure Classification
XP
12
4. Homogeneous and Non-Homogeneous DATA STRUCTURE
 Homogeneous Data Structure
 The data structure which store same types of data elements is called
homogeneous data structure
 For example: array,
 Int a[150] – array variable ‘a’ can store 150 data elements and all the
elements must be of integer type only
 Non Homogeneous Data Structure
 The data structure which store different types of data elements is called
non homogeneous data structure
 For example: structure
Struct student{
Int roll_number;
Char name[100];
Float marks;
}s1;
Note: student structure can store integer, character and float type of data elements
XP
13
DATA STRUCTURE - OPERATIONS
1. CREATIONS: The process of creating a new data structure
2. INSERTIONS: The process of inserting data element into an existing data
structure
3. DELETIONS: The process of deleting data element from a data structure
4. TRAVERSING: The process of visiting each and every element of a data
structure
5. CONCATENATION: The process of concatenating one data structure into
another
6. SEARCHING: The process of finding the desired data element from a set of
data elements of a data structure
7. SORTING: The process of arranging a set of data elements in some specific
order for example ascending order, descending order
8. DISPLAY: The process of sowing all the elements of a data structure
9. DESTROYING: The process of destroying the whole data structure
XP
14
DATA STRUCTURE - EXAMPLES
1. ARRAY
2. STACK
3. QUEUE
4. LINKED LIST
5. TREE
6. GRAPH
7. SORTING
8. SEARCHING
XP
15
DATA STRUCTURE - ARRAY
 Array is a data structure that is used to store a set of homogeneous data
element in the form of index, value pairs in a consecutive memory location
under the same name
 char name[7] = {‘A’, ‘B’, ‘C’, ‘D’, ‘E’};
 name[0] = ‘A’
 name[1] = ‘B’
 name[2] = ‘C’
 name[3] = ‘D’
 name[4] = ‘E’
Figure 1.4: Showing Array
XP
16
DATA STRUCTURE - STACK
 Stack is non primitive linear data structure in which the insertion of data element
and deletion of data element is done from only one end called the Top of the
Stack (TOS).
 TOP of a STACK is initialize to -1 (TOP = -1)
Figure 1.5: Stack
 Stack works on the principle of LIFO (Last in First
Out).
 The Process of inserting data element into a
Stack is called PUSH operation and in every
PUSH operation the variable TOP is incremented
by 1. If TOP = MAX-1 then the STACK is overflow
condition.
 The Process of deleting data element from a
Stack is called POP operation and in every POP
operation the variable TOP is decremented by 1.
If TOP = -1 then the STACK is Underflow
condition.
XP
17
DATA STRUCTURE - QUEUE
 QUEUE is non primitive linear data structure in which the data elements are
inserted from one end called rear of a queue and deleted from another end
called front of a queue.
 REAR and FRON of a QUEUE is initialize to -1 (REAR = -1, FRONT=-1)
Figure 1.6: Queue
 Queue works on the principle of FIFO (First in First Out).
 The Process of inserting data element into a Queue is called ENQUEUE
operation and in every QUEUE operation the variable REAR is incremented
by 1.
 The Process of deleting data element from a Queue is called DEQUEUE
operation and in every DEQUEUE operation the variable FRONT is
incremented by 1.
XP
18
DATA STRUCTURE – LINKED LIST
 Lists are the most commonly used non primitive linear data structures.
 List can be defined as a collection of variable number of data elements.
 An element of a list is called node and each node of a list contains at least two
fields one for storing actual information and another field is used for storing
address of next element (use pointer).
 Types Of Linked List
 Singly Linked List
 Circular Linked List
 Doubly Linked List
 Circular Doubly Linked List
Figure 1.7: Singly Linked List
XP
19
DATA STRUCTURE - TREE
 Tree is a non primitive nonlinear data structures in which data elements are
arranged or sorted in a sorted order.
 A tree is a finite set of data elements (nodes). The data elements in a tree are
represent the hierarchical relationship between various elements.
Figure 1.8: Tree
XP
20
DATA STRUCTURE - GRAPH
 Graph is a nonlinear data structure used to represent many kinds of physical
structures.
 Its application is in Computer network, Engineering Science, Mathematics,
Chemistry etc.
 Thus a graph G is a collection of two sets V and E, where V is the vertices
v0,v1,……. vn – 1 and E is the collection of edges e1, e2, …….en. this can b0e
represented as
 G = (V, E) where,
Figure 1.9: Graph
V(G) = (v0, v1,……….vn) or
set of vertices
E(G) = (e1, e2,……….en) or
set of edges
XP
21
DATA STRUCTURE - SORTING
 A sorting is a process of arranging data-elements in some particular order.
 The order may be either in ascending or descending or some priority based
order.
 Types of Sorting
 Internal Sorting
 External Sorting
 Types of Internal Sorting
 Bubble sort
 Selection sort
 Insertion sort
 Quick sort
Figure 1.10: Sorting
 Merge sort
 Shell sort
 Radix sort
 Heap sort
XP
22
DATA STRUCTURE - SEARCHING
 A Searching is a process of identifying a data element from a set of data with a
help of key. Where key may be either internal key or external key.
 Types of Searching
 Internal Searching
 External Searching
 Types of Internal Searching
 Sequential Search
 Binary Search
 Interpolation searching
 Searching Cases
 Best Case: Search success with minimum time or comparisons.
 Worst Case: Search takes maximum time or comparisons or search failed
 Average Case: Search takes average time.
XP
23
DATA STRUCTURE - IMPLEMENTATION
1. Static Implementation of Data Structure
 Array is used in static implementation of data structure
 The size of data structure cannot be varying during the execution time
 It is useful, if the size of the data structure is fixed.
 Int a[150] – array variable ‘a’ can store 150 data
Advantages:
 Searching is faster as elements are in continuous memory locations
 Compiler manage the memory
Disadvantages:
 The size is fixed. It must be known at design time.
 Insertion and deletion involves unnecessary shifting the rest of the elements
2. Dynamic Implementation of Data Structure
 Pointer is used in Dynamic implementation of data structure
XP
24
DATA STRUCTURE – DYNAMIC IMPLEMENTATION(contd…)
 Dynamic memory allocation (Allocate the memory whenever required and de-
allocate the memory whenever the memory is no longer needed) leads the
data structure dynamic
 The size of data structure may grow and shrink during the execution time.
 Various DMA functions are used. For example, There are four library
functions malloc( ), calloc( ), free( ) and realloc( ) for memory management.
These functions are defined within header file stdlib.h and alloc.h
For example:
Int *ptr;
Syntax: Ptr = (data_type*)malloc(sizeof(data_type));
For example: Ptr = (int*)malloc(sizeof(int));
Syntax: Ptr = (data_type*)calloc(no_of_bnlock,size_of_each_block);
Syntax: Ptr = realloc(ptr,new_size);
Syntax: Free(ptr);
XP
25
DATA STRUCTURE – ABSTRACT DATA TYPE (ADT)
 An Abstract Data Type is a mathematical model where various mathematical
operations are defined.
 The abstract data type is special kind of data type, whose behavior is defined
by a set of values and set of operations.
 The keyword “Abstract” is used as we can use these data types, we can
perform different operations. But how those operations are working that is
totally hidden from the user.
 When we use abstract data types,
our programs divided into two types:
1. The application: The part that
uses the abstract data type.
2. The implementation: The part
that implements the abstract
data type.
Figure 1.11: Abstract Data Type
XP
26
ALGORITHM
 Algorithm is a step by step procedure to solve the problem. An
algorithm is a sequence of instructions designed in such a way that
if the instructions are executed in the specified sequence, the
desired result will be obtained.
 Characteristics of Algorithm
 Each and every instruction should be precise and
unambiguous. Instruction should be concise and efficient.
 Each instruction should be such that it can be performed in a
finite time.
 Instructions should not be repeated infinitely. This ensures
that the algorithm will ultimately terminate.
 After performing the instructions, that is after the algorithm
terminates, the desire for results must be obtained.
XP
27
ALGORITHM - EXAMPLE
Example 1:
Write an algorithm for checking odd and even. The number is entered
by a user.
Step1: Enter a number from user
Step2: Divide the entered number by 2 and check the remainder
If the remainder is 0,
Print the given number is even
Else
Print the given number is odd
Step3: Stop
XP
28
ALGORITHM - Complexity Analysis
 Time Complexity
 Time Complexity is defined as the amount of time required by a
system to solve a particular problem.
 Time Complexity is depend on implementation of the algorithm,
programming language, optimizing the capabilities of the
computer used, the CPU speed, other hardware characteristics etc
 The time complexity also depends on the amount of data inputted
to an algorithm
 Space Complexity
 The Space complexity is defined as the amount of space required
by a system to solve a particular problem.
 The space needed by the following components
1. Instruction space
2. Data space
3. Environment stack space
XP
29
ALGORITHM - Design Approach
 Greedy algorithm
 Divide and conquer algorithm
 Backtracking
 Randomized algorithms
 There are typically three scenarios of Complexity analysis:
1.Best case: What is the best case or least amount of time this
code/algorithm would need to execute.
2.Worst case: What is the worst case or maximum amount of time
this code/algorithm need to execute.
3.Average case: As the name suggests it the average amount of
time required to execute this code.
XP
30
ALGORITHM - Asymptotic Analysis
 Asymptotic notation is the simplest and easiest way of describing
the running time of an algorithm.
 It represents the efficiency and performance of an algorithm in a
systematic and meaningful manner.
 Asymptotic analysis is the theoretical analysis of an algorithm.
 The following notations are used for asymptotic analysis
1.Big Oh(O) notation
2.Omega (Ω) notation
3.Theta (θ) notation
XP
31
1. Big Oh(O) Notation
 It is used to express the upper bound of the running time of an
algorithm.
 It is denoted by ‘O’. Using this notation, we can compute the
maximum possible amount of time that an algorithm will take for its
completion.
Definition: consider f(n) and g(n) be
two positive functions of n, where n is
the size of the input data. Then f(n) is
big-Oh of g(n), if and only if there
exists a positive constant C and an
integer n0, such thatf(n) ≤ C g(n) and
n>n0
Here, f(n) = Og((n))
Figure 1.12: Big-Oh Notation
XP
32
Big Oh(O) Notation – Contd…
1 O(1) Constant time
2 O(n) linear time of “order N”
3 O(N2) quadratic time of “order N squared”
4 O(log N) logarithmic time of “order log N”
5 O(N log N) logarithmic time of “order N log N”
6 O(N!) factorial time of “order N factorial”
XP
33
2. Big Omega (Ω) Notation
 This notation gives a Lower bound for a function to within a
constant factor.
 We write f(n) = Ω(g(n)) if there are positive constant n0and C such
that to the right of n0,the value of f(n) always lies on or above
Cg(n).
Definition: Let us consider f(n) and
g(n) be two positive functions of n,
where n is the size of the input data.
Then, f(n) is omega of g(n), if and only
if there exists a positive constant C
and an integer n0, such that f(n) ≥ C
g(n) and n>n0
Here, f(n) = Ω(g(n))
Figure 1.13: Big-Omega Notation
XP
34
3. Big Theta (θ) Notation
 The Theta notation is a method that is used to express the running
time of an algorithm between the lower and upper bounds.
 Theta notation is denoted by θ. using this notation; we can
compute the average time that an algorithm will take for its
completion.
Definition: Let us consider f(n) and
g(n) be two positive functions of n,
where n is the size of the input data.
Then, f(n) is theta of g(n), if and only
if there exists two positive constants
C1 and C2, such that,C1 g(n) ≤ f(n) ≤
C2 g(n)
Here, f(n) = θ(g(n))
Figure 1.14: Big-Oh Notation
XP
35
for more remaining chapters mail to:
suwalganesh@gmail.com
Thank You

More Related Content

What's hot

Slide 3 data abstraction & 3 schema
Slide 3 data abstraction & 3 schemaSlide 3 data abstraction & 3 schema
Slide 3 data abstraction & 3 schemaVisakh V
 
UNIT III NON LINEAR DATA STRUCTURES – TREES
UNIT III 	NON LINEAR DATA STRUCTURES – TREESUNIT III 	NON LINEAR DATA STRUCTURES – TREES
UNIT III NON LINEAR DATA STRUCTURES – TREESKathirvel Ayyaswamy
 
BINARY TREE REPRESENTATION.ppt
BINARY TREE REPRESENTATION.pptBINARY TREE REPRESENTATION.ppt
BINARY TREE REPRESENTATION.pptSeethaDinesh
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structureadeel hamid
 
Adbms 11 object structure and type constructor
Adbms 11 object structure and type constructorAdbms 11 object structure and type constructor
Adbms 11 object structure and type constructorVaibhav Khanna
 
1.1 binary tree
1.1 binary tree1.1 binary tree
1.1 binary treeKrish_ver2
 
Tree Data Structure by Daniyal Khan
Tree Data Structure by Daniyal KhanTree Data Structure by Daniyal Khan
Tree Data Structure by Daniyal KhanDaniyal Khan
 
Data Structure - Elementary Data Organization
Data Structure - Elementary  Data Organization Data Structure - Elementary  Data Organization
Data Structure - Elementary Data Organization Uma mohan
 
2nd puc computer science chapter 3 data structures 1
2nd puc computer science chapter 3 data structures 12nd puc computer science chapter 3 data structures 1
2nd puc computer science chapter 3 data structures 1Aahwini Esware gowda
 
Adbms 17 object query language
Adbms 17 object query languageAdbms 17 object query language
Adbms 17 object query languageVaibhav Khanna
 
Abstract data types (adt) intro to data structure part 2
Abstract data types (adt)   intro to data structure part 2Abstract data types (adt)   intro to data structure part 2
Abstract data types (adt) intro to data structure part 2Self-Employed
 
Ppt of dbms e r features
Ppt of dbms e r featuresPpt of dbms e r features
Ppt of dbms e r featuresNirali Akabari
 

What's hot (20)

Balanced Tree (AVL Tree & Red-Black Tree)
Balanced Tree (AVL Tree & Red-Black Tree)Balanced Tree (AVL Tree & Red-Black Tree)
Balanced Tree (AVL Tree & Red-Black Tree)
 
Slide 3 data abstraction & 3 schema
Slide 3 data abstraction & 3 schemaSlide 3 data abstraction & 3 schema
Slide 3 data abstraction & 3 schema
 
UNIT III NON LINEAR DATA STRUCTURES – TREES
UNIT III 	NON LINEAR DATA STRUCTURES – TREESUNIT III 	NON LINEAR DATA STRUCTURES – TREES
UNIT III NON LINEAR DATA STRUCTURES – TREES
 
BINARY TREE REPRESENTATION.ppt
BINARY TREE REPRESENTATION.pptBINARY TREE REPRESENTATION.ppt
BINARY TREE REPRESENTATION.ppt
 
Data Structures
Data StructuresData Structures
Data Structures
 
Binary search trees
Binary search treesBinary search trees
Binary search trees
 
Red black trees
Red black treesRed black trees
Red black trees
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
 
Adbms 11 object structure and type constructor
Adbms 11 object structure and type constructorAdbms 11 object structure and type constructor
Adbms 11 object structure and type constructor
 
1.1 binary tree
1.1 binary tree1.1 binary tree
1.1 binary tree
 
What is sparse matrix
What is sparse matrixWhat is sparse matrix
What is sparse matrix
 
Tree Data Structure by Daniyal Khan
Tree Data Structure by Daniyal KhanTree Data Structure by Daniyal Khan
Tree Data Structure by Daniyal Khan
 
Data Structure - Elementary Data Organization
Data Structure - Elementary  Data Organization Data Structure - Elementary  Data Organization
Data Structure - Elementary Data Organization
 
2nd puc computer science chapter 3 data structures 1
2nd puc computer science chapter 3 data structures 12nd puc computer science chapter 3 data structures 1
2nd puc computer science chapter 3 data structures 1
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
 
Ordbms
OrdbmsOrdbms
Ordbms
 
Adbms 17 object query language
Adbms 17 object query languageAdbms 17 object query language
Adbms 17 object query language
 
Abstract data types (adt) intro to data structure part 2
Abstract data types (adt)   intro to data structure part 2Abstract data types (adt)   intro to data structure part 2
Abstract data types (adt) intro to data structure part 2
 
UNIT-4 TREES.ppt
UNIT-4 TREES.pptUNIT-4 TREES.ppt
UNIT-4 TREES.ppt
 
Ppt of dbms e r features
Ppt of dbms e r featuresPpt of dbms e r features
Ppt of dbms e r features
 

Similar to Data Structures and Algorithms Explained

Similar to Data Structures and Algorithms Explained (20)

Data structure
Data structureData structure
Data structure
 
Data structures
Data structuresData structures
Data structures
 
.DATA STRUCTURES
.DATA STRUCTURES  .DATA STRUCTURES
.DATA STRUCTURES
 
Unit.1 Introduction to Data Structuresres
Unit.1 Introduction to Data StructuresresUnit.1 Introduction to Data Structuresres
Unit.1 Introduction to Data Structuresres
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptx
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptx
 
Data Structures and algoithms Unit - 1.pptx
Data Structures and algoithms Unit - 1.pptxData Structures and algoithms Unit - 1.pptx
Data Structures and algoithms Unit - 1.pptx
 
Data structure
Data structureData structure
Data structure
 
PM.ppt
PM.pptPM.ppt
PM.ppt
 
Data structure and its types.
Data structure and its types.Data structure and its types.
Data structure and its types.
 
2. Introduction to Data Structure.pdf
2. Introduction to Data Structure.pdf2. Introduction to Data Structure.pdf
2. Introduction to Data Structure.pdf
 
1597380885789.ppt
1597380885789.ppt1597380885789.ppt
1597380885789.ppt
 
DSA - Copy.pptx
DSA - Copy.pptxDSA - Copy.pptx
DSA - Copy.pptx
 
UNITIII LDS.pdf
UNITIII LDS.pdfUNITIII LDS.pdf
UNITIII LDS.pdf
 
DATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
DATA STRUCTURE AND ALGORITJM POWERPOINT.pptDATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
DATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
 
Data structure power point presentation
Data structure power point presentation Data structure power point presentation
Data structure power point presentation
 
PM.ppt
PM.pptPM.ppt
PM.ppt
 
data structure details of types and .ppt
data structure details of types and .pptdata structure details of types and .ppt
data structure details of types and .ppt
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
DATA STRUCTURE IN C LANGUAGE
DATA STRUCTURE IN C LANGUAGEDATA STRUCTURE IN C LANGUAGE
DATA STRUCTURE IN C LANGUAGE
 

More from Er. Ganesh Ram Suwal (10)

Bubble Sort
Bubble SortBubble Sort
Bubble Sort
 
Tower of HANOI
Tower of HANOITower of HANOI
Tower of HANOI
 
Doubly Linked List
Doubly Linked ListDoubly Linked List
Doubly Linked List
 
STACK IMPLEMENTATION USING SINGLY LINKED LIST
STACK IMPLEMENTATION USING SINGLY LINKED LISTSTACK IMPLEMENTATION USING SINGLY LINKED LIST
STACK IMPLEMENTATION USING SINGLY LINKED LIST
 
Singly Linked List
Singly Linked ListSingly Linked List
Singly Linked List
 
Stack Data Structure
Stack Data StructureStack Data Structure
Stack Data Structure
 
Circular queue
Circular queueCircular queue
Circular queue
 
Linear queue
Linear queueLinear queue
Linear queue
 
Proposal Writing
Proposal WritingProposal Writing
Proposal Writing
 
Web Technology And Its Scope in NEPAL.pptx
Web Technology And Its Scope in NEPAL.pptxWeb Technology And Its Scope in NEPAL.pptx
Web Technology And Its Scope in NEPAL.pptx
 

Recently uploaded

MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 

Recently uploaded (20)

MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 

Data Structures and Algorithms Explained

  • 1. XP 1 DATA STRUCTURE AND ALGORITHM CHAPTER 1: INTRODUCTION Presented By: Er.Ganesh Ram Suwal BE | ME Computer Engineering Email: suwalganesh@gmail.com Lecturer January 2021
  • 2. XP 2 INTRODUCTION  Fact: Fact is a Universal Truth (either TRUE or FALSE). It is an occurrence in the world. Fact is a raw data. It is collected from questionnaires, survey or from data collection process.  Data: It is simply a collection of fact. Data may be a single value or a set of values. The organization of data leads to the structuring of data.  Information: When we process data we get certain knowledge and that knowledge is known as an Information. Data is a bit of information but not an information itself. Figure 1.1: Data and Information
  • 3. XP 3 DATA STRUCTURE  Data Structure is defined as it is the representation of logical relationship existing between individual elements of data. The data structure is a way of organizing all the data items that considers not only the elements but also their relationship to each other.  So data structures are the building blocks of a program. The selection of a data structure must focuses on following two things 1. The data structure must reflects the relationship existing between the data. 2. The data structure must be simple to process data effectively whenever required
  • 4. XP 4 DATA STRUCTURE  Data Structure specifies four things 1. Organization of Data 2. Accessing methods 3. Degree of associativity 4. Processing for Information  Data structure can be defined as triple {D, F, A}  D is data  F is set of Functions and  A is set of axioms. Permitted Data values + Operations = Data Type Organized Data + Allowed Operations = Data Structure
  • 5. XP 5 DATA STRUCTURE - USES  Data Structure is extensively used in  Database Management System (DBMS)  Data Mining and Warehousing  Compiler Design  Network Analysis  Numerical Analysis  Artificial Intelligence  Operating System  Image Processing  Computer Graphics, etc…
  • 6. XP 6 DATA STRUCTURE - CLASSIFICATION  Primitive and Non Primitive  Primitive Data Structure  Non Primitive Data Structure  According to the Nature of Size  Static Data Structure  Dynamic Data Structure  According to its occurrence  Linear Data Structure  Non Linear Data Structure  Homogeneous and Non-Homogeneous  Homogeneous Data Structure  Non Homogeneous (Heterogeneous) Data Structure
  • 7. XP 7 1. Primitive and Non Primitive DATA STRUCTURE  Primitive data structure  Primitive Data Structures are the basic data structure and they are directly operated by a machine instructions.  The representation of primitive data structure is different on different computers  character, integer, floating point numbers, strings  Non Primitive data structure  Non Primitive Data Structures are complex data structures that are derived from the basic data structure  Non-primitive data structure emphasis on structuring the homogeneous and heterogeneous data elements  Array, List, Files
  • 8. XP 8 Primitive and Non Primitive DATA STRUCTURE Figure 1.2: Primitive and Non Primitive Data Structure Classification
  • 9. XP 9 2. According to the Nature of Size DATA STRUCTURE  Static Data Structure  The data structure which have a fixed data size is called static data structure. The size cannot be vary at run time.  An array is used in static data structure  Char name[100] – the array size is 100 so maximum upto 100 characters can be stored by array variable ‘name’  Dynamic Data Structure  The size of data structures are vary not fixed is called dynamic data structure. It uses the concept of pointer.  DMA (Dynamic Memory Allocation) is used in dynamic data structure. Allocation of memory is done whenever the data required and de- allocation of memory is done whenever the data is no more required  The size of data structure is grow and shrink  Int *ptr  DMA functions malloc(), calloc(), realloc() and free() are used
  • 10. XP 10 3. According to its occurrence DATA STRUCTURE  Linear Data Structure  In linear data structure the data elements are stored in a consecutive memory locations or data are stored in a sequential manner.  For example: array, stack, queue etc  Non Linear Data Structure  In non-linear data structure the data elements are not stored in a consecutive memory location or non-sequential manner.  These data structures are used to represent the hierarchical relationship between data elements.  For example: tree, graph etc.
  • 11. XP 11 According to its occurrence DATA STRUCTURE Figure 1.3: Linear and Non Linear Data Structure Classification
  • 12. XP 12 4. Homogeneous and Non-Homogeneous DATA STRUCTURE  Homogeneous Data Structure  The data structure which store same types of data elements is called homogeneous data structure  For example: array,  Int a[150] – array variable ‘a’ can store 150 data elements and all the elements must be of integer type only  Non Homogeneous Data Structure  The data structure which store different types of data elements is called non homogeneous data structure  For example: structure Struct student{ Int roll_number; Char name[100]; Float marks; }s1; Note: student structure can store integer, character and float type of data elements
  • 13. XP 13 DATA STRUCTURE - OPERATIONS 1. CREATIONS: The process of creating a new data structure 2. INSERTIONS: The process of inserting data element into an existing data structure 3. DELETIONS: The process of deleting data element from a data structure 4. TRAVERSING: The process of visiting each and every element of a data structure 5. CONCATENATION: The process of concatenating one data structure into another 6. SEARCHING: The process of finding the desired data element from a set of data elements of a data structure 7. SORTING: The process of arranging a set of data elements in some specific order for example ascending order, descending order 8. DISPLAY: The process of sowing all the elements of a data structure 9. DESTROYING: The process of destroying the whole data structure
  • 14. XP 14 DATA STRUCTURE - EXAMPLES 1. ARRAY 2. STACK 3. QUEUE 4. LINKED LIST 5. TREE 6. GRAPH 7. SORTING 8. SEARCHING
  • 15. XP 15 DATA STRUCTURE - ARRAY  Array is a data structure that is used to store a set of homogeneous data element in the form of index, value pairs in a consecutive memory location under the same name  char name[7] = {‘A’, ‘B’, ‘C’, ‘D’, ‘E’};  name[0] = ‘A’  name[1] = ‘B’  name[2] = ‘C’  name[3] = ‘D’  name[4] = ‘E’ Figure 1.4: Showing Array
  • 16. XP 16 DATA STRUCTURE - STACK  Stack is non primitive linear data structure in which the insertion of data element and deletion of data element is done from only one end called the Top of the Stack (TOS).  TOP of a STACK is initialize to -1 (TOP = -1) Figure 1.5: Stack  Stack works on the principle of LIFO (Last in First Out).  The Process of inserting data element into a Stack is called PUSH operation and in every PUSH operation the variable TOP is incremented by 1. If TOP = MAX-1 then the STACK is overflow condition.  The Process of deleting data element from a Stack is called POP operation and in every POP operation the variable TOP is decremented by 1. If TOP = -1 then the STACK is Underflow condition.
  • 17. XP 17 DATA STRUCTURE - QUEUE  QUEUE is non primitive linear data structure in which the data elements are inserted from one end called rear of a queue and deleted from another end called front of a queue.  REAR and FRON of a QUEUE is initialize to -1 (REAR = -1, FRONT=-1) Figure 1.6: Queue  Queue works on the principle of FIFO (First in First Out).  The Process of inserting data element into a Queue is called ENQUEUE operation and in every QUEUE operation the variable REAR is incremented by 1.  The Process of deleting data element from a Queue is called DEQUEUE operation and in every DEQUEUE operation the variable FRONT is incremented by 1.
  • 18. XP 18 DATA STRUCTURE – LINKED LIST  Lists are the most commonly used non primitive linear data structures.  List can be defined as a collection of variable number of data elements.  An element of a list is called node and each node of a list contains at least two fields one for storing actual information and another field is used for storing address of next element (use pointer).  Types Of Linked List  Singly Linked List  Circular Linked List  Doubly Linked List  Circular Doubly Linked List Figure 1.7: Singly Linked List
  • 19. XP 19 DATA STRUCTURE - TREE  Tree is a non primitive nonlinear data structures in which data elements are arranged or sorted in a sorted order.  A tree is a finite set of data elements (nodes). The data elements in a tree are represent the hierarchical relationship between various elements. Figure 1.8: Tree
  • 20. XP 20 DATA STRUCTURE - GRAPH  Graph is a nonlinear data structure used to represent many kinds of physical structures.  Its application is in Computer network, Engineering Science, Mathematics, Chemistry etc.  Thus a graph G is a collection of two sets V and E, where V is the vertices v0,v1,……. vn – 1 and E is the collection of edges e1, e2, …….en. this can b0e represented as  G = (V, E) where, Figure 1.9: Graph V(G) = (v0, v1,……….vn) or set of vertices E(G) = (e1, e2,……….en) or set of edges
  • 21. XP 21 DATA STRUCTURE - SORTING  A sorting is a process of arranging data-elements in some particular order.  The order may be either in ascending or descending or some priority based order.  Types of Sorting  Internal Sorting  External Sorting  Types of Internal Sorting  Bubble sort  Selection sort  Insertion sort  Quick sort Figure 1.10: Sorting  Merge sort  Shell sort  Radix sort  Heap sort
  • 22. XP 22 DATA STRUCTURE - SEARCHING  A Searching is a process of identifying a data element from a set of data with a help of key. Where key may be either internal key or external key.  Types of Searching  Internal Searching  External Searching  Types of Internal Searching  Sequential Search  Binary Search  Interpolation searching  Searching Cases  Best Case: Search success with minimum time or comparisons.  Worst Case: Search takes maximum time or comparisons or search failed  Average Case: Search takes average time.
  • 23. XP 23 DATA STRUCTURE - IMPLEMENTATION 1. Static Implementation of Data Structure  Array is used in static implementation of data structure  The size of data structure cannot be varying during the execution time  It is useful, if the size of the data structure is fixed.  Int a[150] – array variable ‘a’ can store 150 data Advantages:  Searching is faster as elements are in continuous memory locations  Compiler manage the memory Disadvantages:  The size is fixed. It must be known at design time.  Insertion and deletion involves unnecessary shifting the rest of the elements 2. Dynamic Implementation of Data Structure  Pointer is used in Dynamic implementation of data structure
  • 24. XP 24 DATA STRUCTURE – DYNAMIC IMPLEMENTATION(contd…)  Dynamic memory allocation (Allocate the memory whenever required and de- allocate the memory whenever the memory is no longer needed) leads the data structure dynamic  The size of data structure may grow and shrink during the execution time.  Various DMA functions are used. For example, There are four library functions malloc( ), calloc( ), free( ) and realloc( ) for memory management. These functions are defined within header file stdlib.h and alloc.h For example: Int *ptr; Syntax: Ptr = (data_type*)malloc(sizeof(data_type)); For example: Ptr = (int*)malloc(sizeof(int)); Syntax: Ptr = (data_type*)calloc(no_of_bnlock,size_of_each_block); Syntax: Ptr = realloc(ptr,new_size); Syntax: Free(ptr);
  • 25. XP 25 DATA STRUCTURE – ABSTRACT DATA TYPE (ADT)  An Abstract Data Type is a mathematical model where various mathematical operations are defined.  The abstract data type is special kind of data type, whose behavior is defined by a set of values and set of operations.  The keyword “Abstract” is used as we can use these data types, we can perform different operations. But how those operations are working that is totally hidden from the user.  When we use abstract data types, our programs divided into two types: 1. The application: The part that uses the abstract data type. 2. The implementation: The part that implements the abstract data type. Figure 1.11: Abstract Data Type
  • 26. XP 26 ALGORITHM  Algorithm is a step by step procedure to solve the problem. An algorithm is a sequence of instructions designed in such a way that if the instructions are executed in the specified sequence, the desired result will be obtained.  Characteristics of Algorithm  Each and every instruction should be precise and unambiguous. Instruction should be concise and efficient.  Each instruction should be such that it can be performed in a finite time.  Instructions should not be repeated infinitely. This ensures that the algorithm will ultimately terminate.  After performing the instructions, that is after the algorithm terminates, the desire for results must be obtained.
  • 27. XP 27 ALGORITHM - EXAMPLE Example 1: Write an algorithm for checking odd and even. The number is entered by a user. Step1: Enter a number from user Step2: Divide the entered number by 2 and check the remainder If the remainder is 0, Print the given number is even Else Print the given number is odd Step3: Stop
  • 28. XP 28 ALGORITHM - Complexity Analysis  Time Complexity  Time Complexity is defined as the amount of time required by a system to solve a particular problem.  Time Complexity is depend on implementation of the algorithm, programming language, optimizing the capabilities of the computer used, the CPU speed, other hardware characteristics etc  The time complexity also depends on the amount of data inputted to an algorithm  Space Complexity  The Space complexity is defined as the amount of space required by a system to solve a particular problem.  The space needed by the following components 1. Instruction space 2. Data space 3. Environment stack space
  • 29. XP 29 ALGORITHM - Design Approach  Greedy algorithm  Divide and conquer algorithm  Backtracking  Randomized algorithms  There are typically three scenarios of Complexity analysis: 1.Best case: What is the best case or least amount of time this code/algorithm would need to execute. 2.Worst case: What is the worst case or maximum amount of time this code/algorithm need to execute. 3.Average case: As the name suggests it the average amount of time required to execute this code.
  • 30. XP 30 ALGORITHM - Asymptotic Analysis  Asymptotic notation is the simplest and easiest way of describing the running time of an algorithm.  It represents the efficiency and performance of an algorithm in a systematic and meaningful manner.  Asymptotic analysis is the theoretical analysis of an algorithm.  The following notations are used for asymptotic analysis 1.Big Oh(O) notation 2.Omega (Ω) notation 3.Theta (θ) notation
  • 31. XP 31 1. Big Oh(O) Notation  It is used to express the upper bound of the running time of an algorithm.  It is denoted by ‘O’. Using this notation, we can compute the maximum possible amount of time that an algorithm will take for its completion. Definition: consider f(n) and g(n) be two positive functions of n, where n is the size of the input data. Then f(n) is big-Oh of g(n), if and only if there exists a positive constant C and an integer n0, such thatf(n) ≤ C g(n) and n>n0 Here, f(n) = Og((n)) Figure 1.12: Big-Oh Notation
  • 32. XP 32 Big Oh(O) Notation – Contd… 1 O(1) Constant time 2 O(n) linear time of “order N” 3 O(N2) quadratic time of “order N squared” 4 O(log N) logarithmic time of “order log N” 5 O(N log N) logarithmic time of “order N log N” 6 O(N!) factorial time of “order N factorial”
  • 33. XP 33 2. Big Omega (Ω) Notation  This notation gives a Lower bound for a function to within a constant factor.  We write f(n) = Ω(g(n)) if there are positive constant n0and C such that to the right of n0,the value of f(n) always lies on or above Cg(n). Definition: Let us consider f(n) and g(n) be two positive functions of n, where n is the size of the input data. Then, f(n) is omega of g(n), if and only if there exists a positive constant C and an integer n0, such that f(n) ≥ C g(n) and n>n0 Here, f(n) = Ω(g(n)) Figure 1.13: Big-Omega Notation
  • 34. XP 34 3. Big Theta (θ) Notation  The Theta notation is a method that is used to express the running time of an algorithm between the lower and upper bounds.  Theta notation is denoted by θ. using this notation; we can compute the average time that an algorithm will take for its completion. Definition: Let us consider f(n) and g(n) be two positive functions of n, where n is the size of the input data. Then, f(n) is theta of g(n), if and only if there exists two positive constants C1 and C2, such that,C1 g(n) ≤ f(n) ≤ C2 g(n) Here, f(n) = θ(g(n)) Figure 1.14: Big-Oh Notation
  • 35. XP 35 for more remaining chapters mail to: suwalganesh@gmail.com Thank You