SlideShare una empresa de Scribd logo
1 de 15
Descargar para leer sin conexión
ALGORITHM



www.eshikshak.
Introduction to Algorithm
● An algorithm is finite set of steps defining the
  solution of a particular problem.
● It can be expressed in English like language,
  called pseudocode, in programming language
  or in the form of flowchart.




               www.eshikshak.co.in
Characteristics
● Input – There are zero or more values which are
  externally supplied.
● Output – At least one value is produced
● Definiteness – Each step must be clear and
  unambiguous
● Finiteness – If we trace the steps of an
  algorithm, then for all cases, the algorithm must
  terminate after a finite number of steps
● Effectiveness – Each step must be sufficiently
  basic that it can in principal be carried out by a
  person using only paper and pencil
                www.eshikshak.co.in
Algorithm Complexity
● There are basically two aspects of computer
  programming.
  ○ Data Organization (i.e Data & structure)
  ○ Algorithm
● The choice of a particular algorithm depends
  on the following consideration :
  ○ Time Complexity (Performance Requirements)
  ○ Space Complexity (Memory Requirements)



               www.eshikshak.co.in
Space Complexity
● It means the amount of memory, algorithm or
  program needs to run to completion.

● Some of the reasons for studying space
  complexity are
  ○ If a multi user system
  ○ Sufficient memory is available to run the
    program



               www.eshikshak.co.in
Space Complexity (Cont.)
● The space needed by a program consists of
  the following components.
  ○ Instruction Space : Space needed to store the
    executable version of the program
  ○ Data Space : Space needed to store all
    constants, variable values and has further
    following components
     ■ Constants, variables, structured variables like
       array and structure
     ■ Dynamically allocated space


                www.eshikshak.co.in
Space Complexity (Cont.)
● Environmental Stack Space : Space needed
  to store the information needed to resume the
  suspended functions.
  ○ Return Address
  ○ Values of all local variables and the values of
    formal parameters in the function being
    involved.




               www.eshikshak.co.in
Time Complexity
● It means the amount of time it needs to run to
  completion
● Reasons for studying time complexity
  ○ Interested to know in advance that whether a
    program will provide a satisfactory real time
    response
  ○ There may be several possible solutions with
    different time requirements



               www.eshikshak.co.in
Expressing Space and Time
Complexity
● The space and/or time complexity is usually
  expressed in form of the function f(n)
   ○ Where n is the input size for a given instance of the
     problem being solved.
● Expressing space and/ or time complexity as a
  function has following reasons
   ○ We may be interested to predict the rate of growth
     of complexity as the size of problem increases.
   ○ To Compare the complexities of two or more
     algorithm
   ○ Since in modern computers, the memory is not a
     sence constraint, therefore, our analysis of
                 www.eshikshak.co.in
     algorithms will be on the basis of time complexity.
Big ‘O’ Notation
● Big O is a characterization scheme that
  allows to measure properties of algorithms
  such time and space complexity.
● It is useful to set the prerequisites of
  algorithms and to develop and design efficient
  algorithms in terms of time and space
  complexity.




              www.eshikshak.co.in
Categories of Algorithm
● Based on Big O notation, the algorithm can
  be categorized as follows
  ○ Constant time O(1)
  ○ Logarithmic time O(log n)
  ○ Linear time O(n)
  ○ Polynomial time O(nk) (for k > 1)
  ○ Exponentail time O(kn) for k > 1




               www.eshikshak.co.in
Algorithm Analysis
● Different ways or algorithms to solve a
  problem.
● Hence, some of the algorithm may be more
  efficient than the others
● There are different types of time complexities
  which can be analyzed for an algorithm
   ○ Best Case Time Analysis
   ○ Average Case Time Analysis
   ○ Worst Case Time Analysis

               www.eshikshak.co.in
Best Case Time Complexity
● It is a measure of the minimum time that the
  algorithm will require for an input of size ‘n’.
● The running time of many algorithms varies
  not only for the inputs of different sizes but
  also for the different inputs of same size
   ○ Example : Sorting or Searching




                www.eshikshak.co.in
Worst Case Time Complexity
● The worst case time complexity of an
  algorithm is a measure of the maximum time
  that the algorithm will require for an input of
  size ‘n’.

● Example : If ‘n’ input data items are supplied in
  reverse order for any sorting algorithm, the
  algorithm will require n2 operations to perform the
  sort.


                www.eshikshak.co.in
Average Case Time Complexity
● The time that an algorithm will require to
  execute a typical input data of size ‘n’ is
  known as average case time complexity.




               www.eshikshak.co.in

Más contenido relacionado

La actualidad más candente

La actualidad más candente (6)

Speeding Up Sub-Optimal MAPF Algorithms
Speeding Up Sub-Optimal MAPF AlgorithmsSpeeding Up Sub-Optimal MAPF Algorithms
Speeding Up Sub-Optimal MAPF Algorithms
 
Cs 331 Data Structures
Cs 331 Data StructuresCs 331 Data Structures
Cs 331 Data Structures
 
Elementary Parallel Algorithms
Elementary Parallel AlgorithmsElementary Parallel Algorithms
Elementary Parallel Algorithms
 
Scalable precise-dynamic-datarace-detection-for-structured-parallelism
Scalable precise-dynamic-datarace-detection-for-structured-parallelismScalable precise-dynamic-datarace-detection-for-structured-parallelism
Scalable precise-dynamic-datarace-detection-for-structured-parallelism
 
1548 PROJECT DEMO
1548 PROJECT DEMO1548 PROJECT DEMO
1548 PROJECT DEMO
 
Chap12 slides
Chap12 slidesChap12 slides
Chap12 slides
 

Similar a Algorithm 110801105245-phpapp01-120223065724-phpapp02

DAA Slides for Multiple topics such as different algorithms
DAA Slides for Multiple topics such as different algorithmsDAA Slides for Multiple topics such as different algorithms
DAA Slides for Multiple topics such as different algorithmsDEVARSHHIRENBHAIPARM
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithmsAsen Bozhilov
 
Introductionofdatastructure 110731092019-phpapp01
Introductionofdatastructure 110731092019-phpapp01Introductionofdatastructure 110731092019-phpapp01
Introductionofdatastructure 110731092019-phpapp01Jay Patel
 
Introduction of data_structure
Introduction of data_structureIntroduction of data_structure
Introduction of data_structureeShikshak
 
Unit 1, ADA.pptx
Unit 1, ADA.pptxUnit 1, ADA.pptx
Unit 1, ADA.pptxjinkhatima
 
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
 
Lecture01 algorithm analysis
Lecture01 algorithm analysisLecture01 algorithm analysis
Lecture01 algorithm analysisZara Nawaz
 
2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptxRahikAhmed1
 
Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and AlgorithmDhaval Kaneria
 
Cupdf.com introduction to-data-structures-and-algorithm
Cupdf.com introduction to-data-structures-and-algorithmCupdf.com introduction to-data-structures-and-algorithm
Cupdf.com introduction to-data-structures-and-algorithmTarikuDabala1
 
Module 1_ Introduction.pptx
Module 1_ Introduction.pptxModule 1_ Introduction.pptx
Module 1_ Introduction.pptxnikshaikh786
 
complexity.pptx
complexity.pptxcomplexity.pptx
complexity.pptxDr.Shweta
 
Introduction to Data Structures Sorting and searching
Introduction to Data Structures Sorting and searchingIntroduction to Data Structures Sorting and searching
Introduction to Data Structures Sorting and searchingMvenkatarao
 
Kompleksitas Algoritma
Kompleksitas AlgoritmaKompleksitas Algoritma
Kompleksitas AlgoritmaAjeng Savitri
 
Design and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptxDesign and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptxSyed Zaid Irshad
 
Intro to Data Structure & Algorithms
Intro to Data Structure & AlgorithmsIntro to Data Structure & Algorithms
Intro to Data Structure & AlgorithmsAkhil Kaushik
 

Similar a Algorithm 110801105245-phpapp01-120223065724-phpapp02 (20)

DAA Slides for Multiple topics such as different algorithms
DAA Slides for Multiple topics such as different algorithmsDAA Slides for Multiple topics such as different algorithms
DAA Slides for Multiple topics such as different algorithms
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithms
 
Introductionofdatastructure 110731092019-phpapp01
Introductionofdatastructure 110731092019-phpapp01Introductionofdatastructure 110731092019-phpapp01
Introductionofdatastructure 110731092019-phpapp01
 
Introduction of data_structure
Introduction of data_structureIntroduction of data_structure
Introduction of data_structure
 
Unit 1, ADA.pptx
Unit 1, ADA.pptxUnit 1, ADA.pptx
Unit 1, ADA.pptx
 
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...
 
Lecture01 algorithm analysis
Lecture01 algorithm analysisLecture01 algorithm analysis
Lecture01 algorithm analysis
 
2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx
 
Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and Algorithm
 
Cupdf.com introduction to-data-structures-and-algorithm
Cupdf.com introduction to-data-structures-and-algorithmCupdf.com introduction to-data-structures-and-algorithm
Cupdf.com introduction to-data-structures-and-algorithm
 
Module 1_ Introduction.pptx
Module 1_ Introduction.pptxModule 1_ Introduction.pptx
Module 1_ Introduction.pptx
 
Python algorithm
Python algorithmPython algorithm
Python algorithm
 
Searching Algorithms
Searching AlgorithmsSearching Algorithms
Searching Algorithms
 
complexity.pptx
complexity.pptxcomplexity.pptx
complexity.pptx
 
Introduction to Data Structures Sorting and searching
Introduction to Data Structures Sorting and searchingIntroduction to Data Structures Sorting and searching
Introduction to Data Structures Sorting and searching
 
Kompleksitas Algoritma
Kompleksitas AlgoritmaKompleksitas Algoritma
Kompleksitas Algoritma
 
Design and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptxDesign and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptx
 
Lec1.ppt
Lec1.pptLec1.ppt
Lec1.ppt
 
Unit ii algorithm
Unit   ii algorithmUnit   ii algorithm
Unit ii algorithm
 
Intro to Data Structure & Algorithms
Intro to Data Structure & AlgorithmsIntro to Data Structure & Algorithms
Intro to Data Structure & Algorithms
 

Más de dhruv patel

Coddrules 120309094848-phpapp02
Coddrules 120309094848-phpapp02Coddrules 120309094848-phpapp02
Coddrules 120309094848-phpapp02dhruv patel
 
Coddrules 120309094807-phpapp01
Coddrules 120309094807-phpapp01Coddrules 120309094807-phpapp01
Coddrules 120309094807-phpapp01dhruv patel
 
Hypertextandhypermedia 120320065133-phpapp01
Hypertextandhypermedia 120320065133-phpapp01Hypertextandhypermedia 120320065133-phpapp01
Hypertextandhypermedia 120320065133-phpapp01dhruv patel
 
Chapter19 multimedia-091006115642-phpapp021-120309093503-phpapp02
Chapter19 multimedia-091006115642-phpapp021-120309093503-phpapp02Chapter19 multimedia-091006115642-phpapp021-120309093503-phpapp02
Chapter19 multimedia-091006115642-phpapp021-120309093503-phpapp02dhruv patel
 
Mutlimediaauthoringtools 120320065815-phpapp01
Mutlimediaauthoringtools 120320065815-phpapp01Mutlimediaauthoringtools 120320065815-phpapp01
Mutlimediaauthoringtools 120320065815-phpapp01dhruv patel
 
Multimedia tools (sound)
Multimedia tools (sound)Multimedia tools (sound)
Multimedia tools (sound)dhruv patel
 
Multimedia tools(images)
Multimedia tools(images)Multimedia tools(images)
Multimedia tools(images)dhruv patel
 
Anchor data type,cursor data type,array data type
Anchor data type,cursor data type,array data typeAnchor data type,cursor data type,array data type
Anchor data type,cursor data type,array data typedhruv patel
 

Más de dhruv patel (8)

Coddrules 120309094848-phpapp02
Coddrules 120309094848-phpapp02Coddrules 120309094848-phpapp02
Coddrules 120309094848-phpapp02
 
Coddrules 120309094807-phpapp01
Coddrules 120309094807-phpapp01Coddrules 120309094807-phpapp01
Coddrules 120309094807-phpapp01
 
Hypertextandhypermedia 120320065133-phpapp01
Hypertextandhypermedia 120320065133-phpapp01Hypertextandhypermedia 120320065133-phpapp01
Hypertextandhypermedia 120320065133-phpapp01
 
Chapter19 multimedia-091006115642-phpapp021-120309093503-phpapp02
Chapter19 multimedia-091006115642-phpapp021-120309093503-phpapp02Chapter19 multimedia-091006115642-phpapp021-120309093503-phpapp02
Chapter19 multimedia-091006115642-phpapp021-120309093503-phpapp02
 
Mutlimediaauthoringtools 120320065815-phpapp01
Mutlimediaauthoringtools 120320065815-phpapp01Mutlimediaauthoringtools 120320065815-phpapp01
Mutlimediaauthoringtools 120320065815-phpapp01
 
Multimedia tools (sound)
Multimedia tools (sound)Multimedia tools (sound)
Multimedia tools (sound)
 
Multimedia tools(images)
Multimedia tools(images)Multimedia tools(images)
Multimedia tools(images)
 
Anchor data type,cursor data type,array data type
Anchor data type,cursor data type,array data typeAnchor data type,cursor data type,array data type
Anchor data type,cursor data type,array data type
 

Último

Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfSanaAli374401
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.MateoGardella
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 

Último (20)

Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 

Algorithm 110801105245-phpapp01-120223065724-phpapp02

  • 2. Introduction to Algorithm ● An algorithm is finite set of steps defining the solution of a particular problem. ● It can be expressed in English like language, called pseudocode, in programming language or in the form of flowchart. www.eshikshak.co.in
  • 3. Characteristics ● Input – There are zero or more values which are externally supplied. ● Output – At least one value is produced ● Definiteness – Each step must be clear and unambiguous ● Finiteness – If we trace the steps of an algorithm, then for all cases, the algorithm must terminate after a finite number of steps ● Effectiveness – Each step must be sufficiently basic that it can in principal be carried out by a person using only paper and pencil www.eshikshak.co.in
  • 4. Algorithm Complexity ● There are basically two aspects of computer programming. ○ Data Organization (i.e Data & structure) ○ Algorithm ● The choice of a particular algorithm depends on the following consideration : ○ Time Complexity (Performance Requirements) ○ Space Complexity (Memory Requirements) www.eshikshak.co.in
  • 5. Space Complexity ● It means the amount of memory, algorithm or program needs to run to completion. ● Some of the reasons for studying space complexity are ○ If a multi user system ○ Sufficient memory is available to run the program www.eshikshak.co.in
  • 6. Space Complexity (Cont.) ● The space needed by a program consists of the following components. ○ Instruction Space : Space needed to store the executable version of the program ○ Data Space : Space needed to store all constants, variable values and has further following components ■ Constants, variables, structured variables like array and structure ■ Dynamically allocated space www.eshikshak.co.in
  • 7. Space Complexity (Cont.) ● Environmental Stack Space : Space needed to store the information needed to resume the suspended functions. ○ Return Address ○ Values of all local variables and the values of formal parameters in the function being involved. www.eshikshak.co.in
  • 8. Time Complexity ● It means the amount of time it needs to run to completion ● Reasons for studying time complexity ○ Interested to know in advance that whether a program will provide a satisfactory real time response ○ There may be several possible solutions with different time requirements www.eshikshak.co.in
  • 9. Expressing Space and Time Complexity ● The space and/or time complexity is usually expressed in form of the function f(n) ○ Where n is the input size for a given instance of the problem being solved. ● Expressing space and/ or time complexity as a function has following reasons ○ We may be interested to predict the rate of growth of complexity as the size of problem increases. ○ To Compare the complexities of two or more algorithm ○ Since in modern computers, the memory is not a sence constraint, therefore, our analysis of www.eshikshak.co.in algorithms will be on the basis of time complexity.
  • 10. Big ‘O’ Notation ● Big O is a characterization scheme that allows to measure properties of algorithms such time and space complexity. ● It is useful to set the prerequisites of algorithms and to develop and design efficient algorithms in terms of time and space complexity. www.eshikshak.co.in
  • 11. Categories of Algorithm ● Based on Big O notation, the algorithm can be categorized as follows ○ Constant time O(1) ○ Logarithmic time O(log n) ○ Linear time O(n) ○ Polynomial time O(nk) (for k > 1) ○ Exponentail time O(kn) for k > 1 www.eshikshak.co.in
  • 12. Algorithm Analysis ● Different ways or algorithms to solve a problem. ● Hence, some of the algorithm may be more efficient than the others ● There are different types of time complexities which can be analyzed for an algorithm ○ Best Case Time Analysis ○ Average Case Time Analysis ○ Worst Case Time Analysis www.eshikshak.co.in
  • 13. Best Case Time Complexity ● It is a measure of the minimum time that the algorithm will require for an input of size ‘n’. ● The running time of many algorithms varies not only for the inputs of different sizes but also for the different inputs of same size ○ Example : Sorting or Searching www.eshikshak.co.in
  • 14. Worst Case Time Complexity ● The worst case time complexity of an algorithm is a measure of the maximum time that the algorithm will require for an input of size ‘n’. ● Example : If ‘n’ input data items are supplied in reverse order for any sorting algorithm, the algorithm will require n2 operations to perform the sort. www.eshikshak.co.in
  • 15. Average Case Time Complexity ● The time that an algorithm will require to execute a typical input data of size ‘n’ is known as average case time complexity. www.eshikshak.co.in