SlideShare a Scribd company logo
Bis illa -Ra a -Ra e
   m h-e hm n-e he m

      COMPLEXITY OF
     ALGORITHM AND
   COST_TIME TRADE OFF
By

   Muhammad Muzammal


E-Mail: hello-hi99@hotmail.com
Intro uc n
            d tio


Algorithm

   An algorithm is a finite set of well-defined instructions
  for accomplishing some task, which given an initial
  state, will terminate in a defined end-state.
Complexity of algorithms

Complexity of algorithms
  The complexity of an algorithm is a function f (n) which measures
  the time and space used by an algorithm in terms of input size n.
    In computer science, the complexity of an algorithm is a way
  to classify how efficient an algorithm is, compared to alternative
  ones. The focus is on how execution time increases with the data
  set to be processed.
   The computational complexity and efficient implementation of the
  algorithm are important in computing, and this depends on
  suitable data structures.
Complexity of algorithms

Description of Complexity
Different algorithms may complete the same task with
a different set of instructions in less or more time,
space or effort than other. The analysis and study of
algorithms is a discipline in Computer Science which
has a strong mathematical background. It often relies
on theoretical analysis of pseudo-code. To compare
the efficiency of algorithms, we don't rely on abstract
measures such as the time difference in running
speed, since it too heavily relies on the processor
power and other tasks running in parallel.
Classes of complexity

Polynomial time algorithms
•(C) --- Constant time --- the time necessary to perform
the algorithm does not change in response to the size of
the problem.
•(n) --- Linear time --- the time grows linearly with the size
(n) of the problem.
• (n2) --- Quadratic time --- the time grows quadratically
with the size (n) of the problem
Classes of complexity

Sub-linear time algorithms
• It grow slower than linear time algorithms
• Super-polynomial time algorithms
• It grows faster than polynomial time algorithms.
• Exponential time --- the time required grows
exponentially with the size of the problem.
Example of finding the complexity of an
                    algorithm

BUBBLE SORT
For ( int I = 0 ; I < 5 ; I ++ )
             For ( int j = 0 ; j < 4 ; j ++ )
        If (A [ j ] > A [ j + 1 ] ) {
                Temp = A [ j ] ;
A [ j ] = A [ j+1 ] ;
A [ j + 1 ] =Temp;
               }
Complexity of Bubble Sort

  The time for assorting algorithm is measured in the
number of the comparisons. The number of f(n) of
comparisons in the bubble sort is easily computed.
Specifically ,there are n-1 comparisons during the 1st
pass , which places the largest element in the last
position ; there are n-2 comparisons in the 2nd step,
which places the 2nd largest element in the next –to-
last position; and so on.. In other words, the time
required to execute the bubble sort algorithm is
proportional to n2, where n is the number of input
items.
Example of finding the complexity of an
                      algorithm
Linear Search
Int array[10]={10,20,30,40,50,60,70,80,90,100};
Int I,n, Loc=-1;
Cout<<“Enter the value to find “;
Cin>>n;
For(i=0;I<10;I++)
  if(array[I]==n)
   Loc=I;
If(Loc==-1)
  Cout<<“Value not found”;
Else
  Cout<<“The value”<<n<<“is found at index “<<Loc;
Space-time tradeoff

 In computer science, a space-time tradeoff refers to a
choice between algorithmic solutions of a data
processing problem that allows one to derease the
running time of an algorithmic solution by increasing
the space to store the data and vice versa.
The computation time can be reduced at the cost of
increased memory use. As the relative costs of CPU
cycles, RAM space, and hard drive space change —
hard drive space has for some time been getting
cheaper at a much faster rate than other components
of computers, the appropriate choices for space-time
tradeoffs have changed radically. Often, by exploiting
a space-time tradeoff, a program can be made to run
much faster.
Space-time tradeoff

 A space-time tradeoff can be applied to the
problem of data storage. If data is stored
uncompressed, it takes more space but less time
than if the data were stored compressed (since
compressing the data reduces the amount of
space it takes, but it takes time to run the
compression algorithm). Depending on the
particular instance of the problem, either way is
practical.
Continued…

  Larger code size can be traded for higher program
speed when applying loop unwinding. This technique
makes the code longer for each iteration of a loop, but
saves the computation time required for jumping back to
the beginning of the loop at the end of each iteration.

   Algorithms that make use of space-time tradeoffs to
achieve better running times include the baby-step
giant-step algorithm for calculating discrete logarithms
Using Genetic Algorithms to Solve
   Construction Time-Cost Trade-Off Problems

 Existing methods for time-cost trade-off analysis focus
on using heuristics or mathematical programming.
These methods, however, are not efficient enough to
solve large-scale CPM networks (hundreds of activities
or more). Analogous to natural selection and genetics in
reproduction, genetic algorithms (GAs) have been
successfully adopted to solve many science and
engineering problems and have proven to be an
efficient means for searching optimal solutions in a
large problem domain computer program that can
execute the algorithm efficiently.
Ad

More Related Content

What's hot (20)

Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
Nikhil Sharma
 
Divide and conquer
Divide and conquerDivide and conquer
Divide and conquer
Dr Shashikant Athawale
 
Asymptotic Notation
Asymptotic NotationAsymptotic Notation
Asymptotic Notation
Protap Mondal
 
Time complexity
Time complexityTime complexity
Time complexity
Katang Isip
 
Analysis and Design of Algorithms
Analysis and Design of AlgorithmsAnalysis and Design of Algorithms
Analysis and Design of Algorithms
Bulbul Agrawal
 
Algorithm analysis
Algorithm analysisAlgorithm analysis
Algorithm analysis
sumitbardhan
 
CONTEXT FREE GRAMMAR
CONTEXT FREE GRAMMAR CONTEXT FREE GRAMMAR
CONTEXT FREE GRAMMAR
Zahid Parvez
 
Complexity analysis in Algorithms
Complexity analysis in AlgorithmsComplexity analysis in Algorithms
Complexity analysis in Algorithms
Daffodil International University
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS
Gayathri Gaayu
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
Pranay Neema
 
Graph in data structure
Graph in data structureGraph in data structure
Graph in data structure
Abrish06
 
Daa notes 1
Daa notes 1Daa notes 1
Daa notes 1
smruti sarangi
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)
swapnac12
 
Asymptotic Notations
Asymptotic NotationsAsymptotic Notations
Asymptotic Notations
Rishabh Soni
 
Greedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack ProblemGreedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack Problem
Madhu Bala
 
Big o notation
Big o notationBig o notation
Big o notation
hamza mushtaq
 
8 queens problem using back tracking
8 queens problem using back tracking8 queens problem using back tracking
8 queens problem using back tracking
Tech_MX
 
SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS
Md. Shafiuzzaman Hira
 
Sum of subset problem.pptx
Sum of subset problem.pptxSum of subset problem.pptx
Sum of subset problem.pptx
V.V.Vanniaperumal College for Women
 
Hash table
Hash tableHash table
Hash table
Rajendran
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
Nikhil Sharma
 
Analysis and Design of Algorithms
Analysis and Design of AlgorithmsAnalysis and Design of Algorithms
Analysis and Design of Algorithms
Bulbul Agrawal
 
Algorithm analysis
Algorithm analysisAlgorithm analysis
Algorithm analysis
sumitbardhan
 
CONTEXT FREE GRAMMAR
CONTEXT FREE GRAMMAR CONTEXT FREE GRAMMAR
CONTEXT FREE GRAMMAR
Zahid Parvez
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS
Gayathri Gaayu
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
Pranay Neema
 
Graph in data structure
Graph in data structureGraph in data structure
Graph in data structure
Abrish06
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)
swapnac12
 
Asymptotic Notations
Asymptotic NotationsAsymptotic Notations
Asymptotic Notations
Rishabh Soni
 
Greedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack ProblemGreedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack Problem
Madhu Bala
 
8 queens problem using back tracking
8 queens problem using back tracking8 queens problem using back tracking
8 queens problem using back tracking
Tech_MX
 

Viewers also liked (12)

Data Structure: Algorithm and analysis
Data Structure: Algorithm and analysisData Structure: Algorithm and analysis
Data Structure: Algorithm and analysis
Dr. Rajdeep Chatterjee
 
358 33 powerpoint-slides_14-sorting_chapter-14
358 33 powerpoint-slides_14-sorting_chapter-14358 33 powerpoint-slides_14-sorting_chapter-14
358 33 powerpoint-slides_14-sorting_chapter-14
sumitbardhan
 
Sorting
SortingSorting
Sorting
Gopi Saiteja
 
Sorting
SortingSorting
Sorting
Zaid Shabbir
 
Counting sort(Non Comparison Sort)
Counting sort(Non Comparison Sort)Counting sort(Non Comparison Sort)
Counting sort(Non Comparison Sort)
Hossain Md Shakhawat
 
Lecture 07 Data Structures - Basic Sorting
Lecture 07 Data Structures - Basic SortingLecture 07 Data Structures - Basic Sorting
Lecture 07 Data Structures - Basic Sorting
Haitham El-Ghareeb
 
Sorting
SortingSorting
Sorting
Ashim Lamichhane
 
Merge sort and quick sort
Merge sort and quick sortMerge sort and quick sort
Merge sort and quick sort
Shakila Mahjabin
 
Data Structures & Algorithm design using C
Data Structures & Algorithm design using C Data Structures & Algorithm design using C
Data Structures & Algorithm design using C
Emertxe Information Technologies Pvt Ltd
 
Time and space complexity
Time and space complexityTime and space complexity
Time and space complexity
Ankit Katiyar
 
Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and Algorithm
Dhaval Kaneria
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
Mohammed Hussein
 
Ad

Similar to Complexity of Algorithm (20)

presentationfinal-090714235255-phpapp01 (1) (2).pptx
presentationfinal-090714235255-phpapp01 (1) (2).pptxpresentationfinal-090714235255-phpapp01 (1) (2).pptx
presentationfinal-090714235255-phpapp01 (1) (2).pptx
javed75
 
algocomplexity cost effective tradeoff in
algocomplexity cost effective tradeoff inalgocomplexity cost effective tradeoff in
algocomplexity cost effective tradeoff in
javed75
 
Unit i basic concepts of algorithms
Unit i basic concepts of algorithmsUnit i basic concepts of algorithms
Unit i basic concepts of algorithms
sangeetha s
 
12200223054_SrijanGho;sh_DAA_19.pdfkmkmm
12200223054_SrijanGho;sh_DAA_19.pdfkmkmm12200223054_SrijanGho;sh_DAA_19.pdfkmkmm
12200223054_SrijanGho;sh_DAA_19.pdfkmkmm
arijitghosal14
 
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...
AntareepMajumder
 
Data Structures and Agorithm: DS 22 Analysis of Algorithm.pptx
Data Structures and Agorithm: DS 22 Analysis of Algorithm.pptxData Structures and Agorithm: DS 22 Analysis of Algorithm.pptx
Data Structures and Agorithm: DS 22 Analysis of Algorithm.pptx
RashidFaridChishti
 
Data Structure and Algorithm chapter two, This material is for Data Structure...
Data Structure and Algorithm chapter two, This material is for Data Structure...Data Structure and Algorithm chapter two, This material is for Data Structure...
Data Structure and Algorithm chapter two, This material is for Data Structure...
bekidea
 
Design Analysis of Alogorithm 1 ppt 2024.pptx
Design Analysis of Alogorithm 1 ppt 2024.pptxDesign Analysis of Alogorithm 1 ppt 2024.pptx
Design Analysis of Alogorithm 1 ppt 2024.pptx
rajesshs31r
 
Analysis of Algorithm full version 2024.pptx
Analysis of Algorithm  full version  2024.pptxAnalysis of Algorithm  full version  2024.pptx
Analysis of Algorithm full version 2024.pptx
rajesshs31r
 
Algorithm for the DAA agscsnak javausmagagah
Algorithm for the DAA agscsnak javausmagagahAlgorithm for the DAA agscsnak javausmagagah
Algorithm for the DAA agscsnak javausmagagah
RaviPandey598038
 
TIME EXECUTION OF DIFFERENT SORTED ALGORITHMS
TIME EXECUTION   OF  DIFFERENT SORTED ALGORITHMSTIME EXECUTION   OF  DIFFERENT SORTED ALGORITHMS
TIME EXECUTION OF DIFFERENT SORTED ALGORITHMS
Tanya Makkar
 
Algorithm analysis in fundamentals of data structure
Algorithm analysis in fundamentals of data structureAlgorithm analysis in fundamentals of data structure
Algorithm analysis in fundamentals of data structure
Vrushali Dhanokar
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithms
iqbalphy1
 
BCSE202Lkkljkljkbbbnbnghghjghghghghghghghgh
BCSE202LkkljkljkbbbnbnghghjghghghghghghghghBCSE202Lkkljkljkbbbnbnghghjghghghghghghghgh
BCSE202Lkkljkljkbbbnbnghghjghghghghghghghgh
shivapatil54
 
Performance analysis and randamized agoritham
Performance analysis and randamized agorithamPerformance analysis and randamized agoritham
Performance analysis and randamized agoritham
lilyMalar1
 
Kompleksitas Algoritma
Kompleksitas AlgoritmaKompleksitas Algoritma
Kompleksitas Algoritma
Ajeng Savitri
 
algorithmanalysisinfundamentalsofdatastructure-190810085243.pptx
algorithmanalysisinfundamentalsofdatastructure-190810085243.pptxalgorithmanalysisinfundamentalsofdatastructure-190810085243.pptx
algorithmanalysisinfundamentalsofdatastructure-190810085243.pptx
ShirishaBuduputi
 
Analyzing algorithms
Analyzing algorithmsAnalyzing algorithms
Analyzing algorithms
Onkar Nath Sharma
 
Time andspacecomplexity
Time andspacecomplexityTime andspacecomplexity
Time andspacecomplexity
LAKSHMITHARUN PONNAM
 
Fundamentals of the Analysis of Algorithm Efficiency
Fundamentals of the Analysis of Algorithm EfficiencyFundamentals of the Analysis of Algorithm Efficiency
Fundamentals of the Analysis of Algorithm Efficiency
Saranya Natarajan
 
presentationfinal-090714235255-phpapp01 (1) (2).pptx
presentationfinal-090714235255-phpapp01 (1) (2).pptxpresentationfinal-090714235255-phpapp01 (1) (2).pptx
presentationfinal-090714235255-phpapp01 (1) (2).pptx
javed75
 
algocomplexity cost effective tradeoff in
algocomplexity cost effective tradeoff inalgocomplexity cost effective tradeoff in
algocomplexity cost effective tradeoff in
javed75
 
Unit i basic concepts of algorithms
Unit i basic concepts of algorithmsUnit i basic concepts of algorithms
Unit i basic concepts of algorithms
sangeetha s
 
12200223054_SrijanGho;sh_DAA_19.pdfkmkmm
12200223054_SrijanGho;sh_DAA_19.pdfkmkmm12200223054_SrijanGho;sh_DAA_19.pdfkmkmm
12200223054_SrijanGho;sh_DAA_19.pdfkmkmm
arijitghosal14
 
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...
AntareepMajumder
 
Data Structures and Agorithm: DS 22 Analysis of Algorithm.pptx
Data Structures and Agorithm: DS 22 Analysis of Algorithm.pptxData Structures and Agorithm: DS 22 Analysis of Algorithm.pptx
Data Structures and Agorithm: DS 22 Analysis of Algorithm.pptx
RashidFaridChishti
 
Data Structure and Algorithm chapter two, This material is for Data Structure...
Data Structure and Algorithm chapter two, This material is for Data Structure...Data Structure and Algorithm chapter two, This material is for Data Structure...
Data Structure and Algorithm chapter two, This material is for Data Structure...
bekidea
 
Design Analysis of Alogorithm 1 ppt 2024.pptx
Design Analysis of Alogorithm 1 ppt 2024.pptxDesign Analysis of Alogorithm 1 ppt 2024.pptx
Design Analysis of Alogorithm 1 ppt 2024.pptx
rajesshs31r
 
Analysis of Algorithm full version 2024.pptx
Analysis of Algorithm  full version  2024.pptxAnalysis of Algorithm  full version  2024.pptx
Analysis of Algorithm full version 2024.pptx
rajesshs31r
 
Algorithm for the DAA agscsnak javausmagagah
Algorithm for the DAA agscsnak javausmagagahAlgorithm for the DAA agscsnak javausmagagah
Algorithm for the DAA agscsnak javausmagagah
RaviPandey598038
 
TIME EXECUTION OF DIFFERENT SORTED ALGORITHMS
TIME EXECUTION   OF  DIFFERENT SORTED ALGORITHMSTIME EXECUTION   OF  DIFFERENT SORTED ALGORITHMS
TIME EXECUTION OF DIFFERENT SORTED ALGORITHMS
Tanya Makkar
 
Algorithm analysis in fundamentals of data structure
Algorithm analysis in fundamentals of data structureAlgorithm analysis in fundamentals of data structure
Algorithm analysis in fundamentals of data structure
Vrushali Dhanokar
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithms
iqbalphy1
 
BCSE202Lkkljkljkbbbnbnghghjghghghghghghghgh
BCSE202LkkljkljkbbbnbnghghjghghghghghghghghBCSE202Lkkljkljkbbbnbnghghjghghghghghghghgh
BCSE202Lkkljkljkbbbnbnghghjghghghghghghghgh
shivapatil54
 
Performance analysis and randamized agoritham
Performance analysis and randamized agorithamPerformance analysis and randamized agoritham
Performance analysis and randamized agoritham
lilyMalar1
 
Kompleksitas Algoritma
Kompleksitas AlgoritmaKompleksitas Algoritma
Kompleksitas Algoritma
Ajeng Savitri
 
algorithmanalysisinfundamentalsofdatastructure-190810085243.pptx
algorithmanalysisinfundamentalsofdatastructure-190810085243.pptxalgorithmanalysisinfundamentalsofdatastructure-190810085243.pptx
algorithmanalysisinfundamentalsofdatastructure-190810085243.pptx
ShirishaBuduputi
 
Fundamentals of the Analysis of Algorithm Efficiency
Fundamentals of the Analysis of Algorithm EfficiencyFundamentals of the Analysis of Algorithm Efficiency
Fundamentals of the Analysis of Algorithm Efficiency
Saranya Natarajan
 
Ad

Recently uploaded (20)

SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
Unit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdfUnit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdf
KanchanPatil34
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
GDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptxGDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptx
azeenhodekar
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
Anti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptxAnti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptx
Mayuri Chavan
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
Introduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe EngineeringIntroduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe Engineering
Damian T. Gordon
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdfBiophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
PKLI-Institute of Nursing and Allied Health Sciences Lahore , Pakistan.
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Library Association of Ireland
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
Unit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdfUnit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdf
KanchanPatil34
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
GDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptxGDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptx
azeenhodekar
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
Anti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptxAnti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptx
Mayuri Chavan
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
Introduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe EngineeringIntroduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe Engineering
Damian T. Gordon
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Library Association of Ireland
 

Complexity of Algorithm

  • 1. Bis illa -Ra a -Ra e m h-e hm n-e he m COMPLEXITY OF ALGORITHM AND COST_TIME TRADE OFF
  • 2. By Muhammad Muzammal E-Mail: [email protected]
  • 3. Intro uc n d tio Algorithm An algorithm is a finite set of well-defined instructions for accomplishing some task, which given an initial state, will terminate in a defined end-state.
  • 4. Complexity of algorithms Complexity of algorithms The complexity of an algorithm is a function f (n) which measures the time and space used by an algorithm in terms of input size n. In computer science, the complexity of an algorithm is a way to classify how efficient an algorithm is, compared to alternative ones. The focus is on how execution time increases with the data set to be processed. The computational complexity and efficient implementation of the algorithm are important in computing, and this depends on suitable data structures.
  • 5. Complexity of algorithms Description of Complexity Different algorithms may complete the same task with a different set of instructions in less or more time, space or effort than other. The analysis and study of algorithms is a discipline in Computer Science which has a strong mathematical background. It often relies on theoretical analysis of pseudo-code. To compare the efficiency of algorithms, we don't rely on abstract measures such as the time difference in running speed, since it too heavily relies on the processor power and other tasks running in parallel.
  • 6. Classes of complexity Polynomial time algorithms •(C) --- Constant time --- the time necessary to perform the algorithm does not change in response to the size of the problem. •(n) --- Linear time --- the time grows linearly with the size (n) of the problem. • (n2) --- Quadratic time --- the time grows quadratically with the size (n) of the problem
  • 7. Classes of complexity Sub-linear time algorithms • It grow slower than linear time algorithms • Super-polynomial time algorithms • It grows faster than polynomial time algorithms. • Exponential time --- the time required grows exponentially with the size of the problem.
  • 8. Example of finding the complexity of an algorithm BUBBLE SORT For ( int I = 0 ; I < 5 ; I ++ ) For ( int j = 0 ; j < 4 ; j ++ ) If (A [ j ] > A [ j + 1 ] ) { Temp = A [ j ] ; A [ j ] = A [ j+1 ] ; A [ j + 1 ] =Temp; }
  • 9. Complexity of Bubble Sort The time for assorting algorithm is measured in the number of the comparisons. The number of f(n) of comparisons in the bubble sort is easily computed. Specifically ,there are n-1 comparisons during the 1st pass , which places the largest element in the last position ; there are n-2 comparisons in the 2nd step, which places the 2nd largest element in the next –to- last position; and so on.. In other words, the time required to execute the bubble sort algorithm is proportional to n2, where n is the number of input items.
  • 10. Example of finding the complexity of an algorithm Linear Search Int array[10]={10,20,30,40,50,60,70,80,90,100}; Int I,n, Loc=-1; Cout<<“Enter the value to find “; Cin>>n; For(i=0;I<10;I++) if(array[I]==n) Loc=I; If(Loc==-1) Cout<<“Value not found”; Else Cout<<“The value”<<n<<“is found at index “<<Loc;
  • 11. Space-time tradeoff In computer science, a space-time tradeoff refers to a choice between algorithmic solutions of a data processing problem that allows one to derease the running time of an algorithmic solution by increasing the space to store the data and vice versa. The computation time can be reduced at the cost of increased memory use. As the relative costs of CPU cycles, RAM space, and hard drive space change — hard drive space has for some time been getting cheaper at a much faster rate than other components of computers, the appropriate choices for space-time tradeoffs have changed radically. Often, by exploiting a space-time tradeoff, a program can be made to run much faster.
  • 12. Space-time tradeoff A space-time tradeoff can be applied to the problem of data storage. If data is stored uncompressed, it takes more space but less time than if the data were stored compressed (since compressing the data reduces the amount of space it takes, but it takes time to run the compression algorithm). Depending on the particular instance of the problem, either way is practical.
  • 13. Continued… Larger code size can be traded for higher program speed when applying loop unwinding. This technique makes the code longer for each iteration of a loop, but saves the computation time required for jumping back to the beginning of the loop at the end of each iteration. Algorithms that make use of space-time tradeoffs to achieve better running times include the baby-step giant-step algorithm for calculating discrete logarithms
  • 14. Using Genetic Algorithms to Solve Construction Time-Cost Trade-Off Problems Existing methods for time-cost trade-off analysis focus on using heuristics or mathematical programming. These methods, however, are not efficient enough to solve large-scale CPM networks (hundreds of activities or more). Analogous to natural selection and genetics in reproduction, genetic algorithms (GAs) have been successfully adopted to solve many science and engineering problems and have proven to be an efficient means for searching optimal solutions in a large problem domain computer program that can execute the algorithm efficiently.