TIME EXECUTION OF DIFFERENT SORTED ALGORITHMSTanya Makkar
what is Algorithm and classification and its complexity
Time Complexity
Time Space trade-off
Asymptotic time complexity of algorithm and its notation
Why do we need to classify running time of algorithm into growth rates?
Big O-h notation and example
Big omega notation and example
Big theta notation and its example
best among the 3 notation
finding complexity f(n) for certain cases
1. Average case
2.Best case
3.Worst case
Searching
Sorting
complexity of Sorting
Conclusion
Unit 1: Fundamentals of the Analysis of Algorithmic Efficiency, Units for Measuring Running Time, PROPERTIES OF AN ALGORITHM, Growth of Functions, Algorithm - Analysis, Asymptotic Notations, Recurrence Relation and problems
Performance analysis is important for algorithms and software features. Asymptotic analysis evaluates how an algorithm's time or space requirements grow with increasing input size, ignoring constants and machine-specific factors. This allows algorithms to be analyzed and compared regardless of machine or small inputs. The document discusses common time complexities like O(1), O(n), O(n log n), and analyzing worst, average, and best cases. It also covers techniques like recursion, amortized analysis, and the master method for solving algorithm recurrences.
Design Analysis of Alogorithm 1 ppt 2024.pptxrajesshs31r
This document discusses algorithms and their analysis. It begins by defining an algorithm as a sequence of unambiguous instructions to solve a problem in a finite amount of time. It then provides examples of Euclid's algorithm for computing the greatest common divisor. The document goes on to discuss the fundamentals of algorithmic problem solving, including understanding the problem, choosing exact or approximate solutions, and algorithm design techniques. It also covers analyzing algorithms by measuring time and space complexity using asymptotic notations.
Analysis of Algorithm full version 2024.pptxrajesshs31r
This document discusses algorithms and their analysis. It begins by defining an algorithm as a sequence of unambiguous instructions to solve a problem in a finite amount of time. Euclid's algorithm for computing the greatest common divisor is provided as an example. The document then covers fundamentals of algorithmic problem solving, including understanding the problem, choosing exact or approximate solutions, and algorithm design techniques. It also discusses analyzing algorithms based on time and space complexity, as well as worst-case, best-case, and average-case efficiencies. Common problem types like sorting, searching, and graph problems are briefly outlined.
This document provides an overview of algorithms including definitions, characteristics, design, and analysis. It defines an algorithm as a finite step-by-step procedure to solve a problem and discusses their key characteristics like input, definiteness, effectiveness, finiteness, and output. The document outlines the design of algorithms using pseudo-code and their analysis in terms of time and space complexity using asymptotic notations like Big O, Big Omega, and Big Theta. Examples are provided to illustrate linear search time complexity and the use of different notations to determine algorithm efficiency.
DSA Complexity.pptx What is Complexity Analysis? What is the need for Compl...2022cspaawan12556
What is Complexity Analysis?
What is the need for Complexity Analysis?
Asymptotic Notations
How to measure complexity?
1. Time Complexity
2. Space Complexity
3. Auxiliary Space
How does Complexity affect any algorithm?
How to optimize the time and space complexity of an Algorithm?
Different types of Complexity exist in the program:
1. Constant Complexity
2. Logarithmic Complexity
3. Linear Complexity
4. Quadratic Complexity
5. Factorial Complexity
6. Exponential Complexity
Worst Case time complexity of different data structures for different operations
Complexity Analysis Of Popular Algorithms
Practice some questions on Complexity Analysis
practice with giving Quiz
Conclusion
This document provides an introduction to algorithms and their design and analysis. It discusses what algorithms are, their key characteristics, and the steps to develop an algorithm to solve a problem. These steps include defining the problem, developing a model, specifying and designing the algorithm, checking correctness, analyzing efficiency, implementing, testing, and documenting. Common algorithm design techniques like top-down design and recursion are explained. Factors that impact algorithm efficiency like use of loops, initial conditions, invariants, and termination conditions are covered. Finally, common control structures for algorithms like if/else, loops, and branching are defined.
The document discusses stacks and queues as linear data structures. A stack follows LIFO (last in first out) where the last element inserted is the first removed. Common stack operations are push to insert and pop to remove elements. Stacks can be implemented using arrays or linked lists. A queue follows FIFO (first in first out) where the first element inserted is the first removed. Common queue operations are enqueue to insert and dequeue to remove elements. Queues can also be implemented using arrays or linked lists. Circular queues and priority queues are also introduced.
The document discusses stacks and queues as linear data structures. A stack follows LIFO (last in first out) where the last element inserted is the first to be removed. Common stack operations are push to add an element and pop to remove an element. Stacks can be implemented using arrays or linked lists. A queue follows FIFO (first in first out) where the first element inserted is the first to be removed. Common queue operations are enqueue to add an element and dequeue to remove an element. Queues can also be implemented using arrays or linked lists. Circular queues and priority queues are also discussed briefly.
This document provides an overview of asymptotic analysis and Landau notation. It discusses justifying algorithm analysis mathematically rather than experimentally. Examples are given to show that two functions may appear different but have the same asymptotic growth rate. Landau symbols like O, Ω, o and Θ are introduced to describe asymptotic upper and lower bounds between functions. Big-Q represents asymptotic equivalence between functions, meaning one can be improved over the other with a faster computer.
2-Algorithms and Complexit data structurey.pdfishan743441
The document discusses algorithms design and complexity analysis. It defines an algorithm as a well-defined sequence of steps to solve a problem and notes that algorithms always take inputs and produce outputs. It discusses different approaches to designing algorithms like greedy, divide and conquer, and dynamic programming. It also covers analyzing algorithm complexity using asymptotic analysis by counting the number of basic operations and deriving the time complexity function in terms of input size.
Linear search examines each element of a list sequentially, one by one, and checks if it is the target value. It has a time complexity of O(n) as it requires searching through each element in the worst case. While simple to implement, linear search is inefficient for large lists as other algorithms like binary search require fewer comparisons.
This document provides an overview of algorithms. It begins by discussing the origins and evolution of the term "algorithm" from its Arabic roots in the 9th century to its modern meaning of a well-defined computational procedure. The document then defines algorithms and their key characteristics such as being precise, unambiguous, and terminating after a finite number of steps. Common algorithm design techniques like divide-and-conquer, greedy algorithms, and dynamic programming are introduced. Examples of merge sort and finding the maximum element in a list are used to illustrate algorithm concepts.
This document contains lecture notes on the design and analysis of algorithms. It covers topics like algorithm definition, complexity analysis, divide and conquer algorithms, greedy algorithms, dynamic programming, and NP-complete problems. The notes provide examples of algorithms like selection sort, towers of Hanoi, and generating permutations. Pseudocode is used to describe algorithms precisely yet readably.
The document discusses algorithms, data abstraction, asymptotic analysis, arrays, polynomials, and sparse matrices. It defines algorithms and discusses their advantages and disadvantages. It explains how to design an algorithm and describes iterative and recursive algorithms. It defines data abstraction and gives an example using smartphones. It discusses time and space complexity analysis and different asymptotic notations like Big O, Omega, and Theta. It describes what arrays are, different types of arrays, and applications of arrays. It explains how to represent and add polynomials using linked lists. Finally, it defines sparse matrices and two methods to represent them using arrays and linked lists.
The document discusses algorithms and data structures. It defines an algorithm as a well-defined procedure that takes input and produces output. Algorithms are used for calculation, data processing, and automated reasoning. The document discusses different ways of describing algorithms including natural language, flowcharts, and pseudo code. It also discusses analyzing the time complexity of algorithms using asymptotic notation such as Big-O, Omega, and Theta notation. Recursive algorithms and solving recurrences are also covered.
This document discusses data structures and algorithms. It provides course objectives which include imparting concepts of data structures and algorithms, introducing searching and sorting techniques, and developing applications using suitable data structures. Course outcomes include understanding algorithm performance analysis, concepts of data structures, linear data structures, and identifying efficient data structure implementations. The document also covers algorithm basics, specifications, expressions, analysis techniques and asymptotic notations for analyzing algorithms.
Oak Ridge National Laboratory (ORNL) is a leading science and technology laboratory under the direction of the Department of Energy.
Hilda Klasky is part of the R&D Staff of the Systems Modeling Group in the Computational Sciences & Engineering Division at ORNL. To prepare the data of the radiology process from the Veterans Affairs Corporate Data Warehouse for her process mining analysis, Hilda had to condense and pre-process the data in various ways. Step by step she shows the strategies that have worked for her to simplify the data to the level that was required to be able to analyze the process with domain experts.
Ad
More Related Content
Similar to Design and analysis of algorithm in Computer Science (20)
This document provides an overview of algorithms including definitions, characteristics, design, and analysis. It defines an algorithm as a finite step-by-step procedure to solve a problem and discusses their key characteristics like input, definiteness, effectiveness, finiteness, and output. The document outlines the design of algorithms using pseudo-code and their analysis in terms of time and space complexity using asymptotic notations like Big O, Big Omega, and Big Theta. Examples are provided to illustrate linear search time complexity and the use of different notations to determine algorithm efficiency.
DSA Complexity.pptx What is Complexity Analysis? What is the need for Compl...2022cspaawan12556
What is Complexity Analysis?
What is the need for Complexity Analysis?
Asymptotic Notations
How to measure complexity?
1. Time Complexity
2. Space Complexity
3. Auxiliary Space
How does Complexity affect any algorithm?
How to optimize the time and space complexity of an Algorithm?
Different types of Complexity exist in the program:
1. Constant Complexity
2. Logarithmic Complexity
3. Linear Complexity
4. Quadratic Complexity
5. Factorial Complexity
6. Exponential Complexity
Worst Case time complexity of different data structures for different operations
Complexity Analysis Of Popular Algorithms
Practice some questions on Complexity Analysis
practice with giving Quiz
Conclusion
This document provides an introduction to algorithms and their design and analysis. It discusses what algorithms are, their key characteristics, and the steps to develop an algorithm to solve a problem. These steps include defining the problem, developing a model, specifying and designing the algorithm, checking correctness, analyzing efficiency, implementing, testing, and documenting. Common algorithm design techniques like top-down design and recursion are explained. Factors that impact algorithm efficiency like use of loops, initial conditions, invariants, and termination conditions are covered. Finally, common control structures for algorithms like if/else, loops, and branching are defined.
The document discusses stacks and queues as linear data structures. A stack follows LIFO (last in first out) where the last element inserted is the first removed. Common stack operations are push to insert and pop to remove elements. Stacks can be implemented using arrays or linked lists. A queue follows FIFO (first in first out) where the first element inserted is the first removed. Common queue operations are enqueue to insert and dequeue to remove elements. Queues can also be implemented using arrays or linked lists. Circular queues and priority queues are also introduced.
The document discusses stacks and queues as linear data structures. A stack follows LIFO (last in first out) where the last element inserted is the first to be removed. Common stack operations are push to add an element and pop to remove an element. Stacks can be implemented using arrays or linked lists. A queue follows FIFO (first in first out) where the first element inserted is the first to be removed. Common queue operations are enqueue to add an element and dequeue to remove an element. Queues can also be implemented using arrays or linked lists. Circular queues and priority queues are also discussed briefly.
This document provides an overview of asymptotic analysis and Landau notation. It discusses justifying algorithm analysis mathematically rather than experimentally. Examples are given to show that two functions may appear different but have the same asymptotic growth rate. Landau symbols like O, Ω, o and Θ are introduced to describe asymptotic upper and lower bounds between functions. Big-Q represents asymptotic equivalence between functions, meaning one can be improved over the other with a faster computer.
2-Algorithms and Complexit data structurey.pdfishan743441
The document discusses algorithms design and complexity analysis. It defines an algorithm as a well-defined sequence of steps to solve a problem and notes that algorithms always take inputs and produce outputs. It discusses different approaches to designing algorithms like greedy, divide and conquer, and dynamic programming. It also covers analyzing algorithm complexity using asymptotic analysis by counting the number of basic operations and deriving the time complexity function in terms of input size.
Linear search examines each element of a list sequentially, one by one, and checks if it is the target value. It has a time complexity of O(n) as it requires searching through each element in the worst case. While simple to implement, linear search is inefficient for large lists as other algorithms like binary search require fewer comparisons.
This document provides an overview of algorithms. It begins by discussing the origins and evolution of the term "algorithm" from its Arabic roots in the 9th century to its modern meaning of a well-defined computational procedure. The document then defines algorithms and their key characteristics such as being precise, unambiguous, and terminating after a finite number of steps. Common algorithm design techniques like divide-and-conquer, greedy algorithms, and dynamic programming are introduced. Examples of merge sort and finding the maximum element in a list are used to illustrate algorithm concepts.
This document contains lecture notes on the design and analysis of algorithms. It covers topics like algorithm definition, complexity analysis, divide and conquer algorithms, greedy algorithms, dynamic programming, and NP-complete problems. The notes provide examples of algorithms like selection sort, towers of Hanoi, and generating permutations. Pseudocode is used to describe algorithms precisely yet readably.
The document discusses algorithms, data abstraction, asymptotic analysis, arrays, polynomials, and sparse matrices. It defines algorithms and discusses their advantages and disadvantages. It explains how to design an algorithm and describes iterative and recursive algorithms. It defines data abstraction and gives an example using smartphones. It discusses time and space complexity analysis and different asymptotic notations like Big O, Omega, and Theta. It describes what arrays are, different types of arrays, and applications of arrays. It explains how to represent and add polynomials using linked lists. Finally, it defines sparse matrices and two methods to represent them using arrays and linked lists.
The document discusses algorithms and data structures. It defines an algorithm as a well-defined procedure that takes input and produces output. Algorithms are used for calculation, data processing, and automated reasoning. The document discusses different ways of describing algorithms including natural language, flowcharts, and pseudo code. It also discusses analyzing the time complexity of algorithms using asymptotic notation such as Big-O, Omega, and Theta notation. Recursive algorithms and solving recurrences are also covered.
This document discusses data structures and algorithms. It provides course objectives which include imparting concepts of data structures and algorithms, introducing searching and sorting techniques, and developing applications using suitable data structures. Course outcomes include understanding algorithm performance analysis, concepts of data structures, linear data structures, and identifying efficient data structure implementations. The document also covers algorithm basics, specifications, expressions, analysis techniques and asymptotic notations for analyzing algorithms.
Oak Ridge National Laboratory (ORNL) is a leading science and technology laboratory under the direction of the Department of Energy.
Hilda Klasky is part of the R&D Staff of the Systems Modeling Group in the Computational Sciences & Engineering Division at ORNL. To prepare the data of the radiology process from the Veterans Affairs Corporate Data Warehouse for her process mining analysis, Hilda had to condense and pre-process the data in various ways. Step by step she shows the strategies that have worked for her to simplify the data to the level that was required to be able to analyze the process with domain experts.
保密服务多伦多都会大学英文毕业证书影本加拿大成绩单多伦多都会大学文凭【q微1954292140】办理多伦多都会大学学位证(TMU毕业证书)成绩单VOID底纹防伪【q微1954292140】帮您解决在加拿大多伦多都会大学未毕业难题(Toronto Metropolitan University)文凭购买、毕业证购买、大学文凭购买、大学毕业证购买、买文凭、日韩文凭、英国大学文凭、美国大学文凭、澳洲大学文凭、加拿大大学文凭(q微1954292140)新加坡大学文凭、新西兰大学文凭、爱尔兰文凭、西班牙文凭、德国文凭、教育部认证,买毕业证,毕业证购买,买大学文凭,购买日韩毕业证、英国大学毕业证、美国大学毕业证、澳洲大学毕业证、加拿大大学毕业证(q微1954292140)新加坡大学毕业证、新西兰大学毕业证、爱尔兰毕业证、西班牙毕业证、德国毕业证,回国证明,留信网认证,留信认证办理,学历认证。从而完成就业。多伦多都会大学毕业证办理,多伦多都会大学文凭办理,多伦多都会大学成绩单办理和真实留信认证、留服认证、多伦多都会大学学历认证。学院文凭定制,多伦多都会大学原版文凭补办,扫描件文凭定做,100%文凭复刻。
特殊原因导致无法毕业,也可以联系我们帮您办理相关材料:
1:在多伦多都会大学挂科了,不想读了,成绩不理想怎么办???
2:打算回国了,找工作的时候,需要提供认证《TMU成绩单购买办理多伦多都会大学毕业证书范本》【Q/WeChat:1954292140】Buy Toronto Metropolitan University Diploma《正式成绩单论文没过》有文凭却得不到认证。又该怎么办???加拿大毕业证购买,加拿大文凭购买,【q微1954292140】加拿大文凭购买,加拿大文凭定制,加拿大文凭补办。专业在线定制加拿大大学文凭,定做加拿大本科文凭,【q微1954292140】复制加拿大Toronto Metropolitan University completion letter。在线快速补办加拿大本科毕业证、硕士文凭证书,购买加拿大学位证、多伦多都会大学Offer,加拿大大学文凭在线购买。
加拿大文凭多伦多都会大学成绩单,TMU毕业证【q微1954292140】办理加拿大多伦多都会大学毕业证(TMU毕业证书)【q微1954292140】学位证书电子图在线定制服务多伦多都会大学offer/学位证offer办理、留信官方学历认证(永久存档真实可查)采用学校原版纸张、特殊工艺完全按照原版一比一制作。帮你解决多伦多都会大学学历学位认证难题。
主营项目:
1、真实教育部国外学历学位认证《加拿大毕业文凭证书快速办理多伦多都会大学毕业证书不见了怎么办》【q微1954292140】《论文没过多伦多都会大学正式成绩单》,教育部存档,教育部留服网站100%可查.
2、办理TMU毕业证,改成绩单《TMU毕业证明办理多伦多都会大学学历认证定制》【Q/WeChat:1954292140】Buy Toronto Metropolitan University Certificates《正式成绩单论文没过》,多伦多都会大学Offer、在读证明、学生卡、信封、证明信等全套材料,从防伪到印刷,从水印到钢印烫金,高精仿度跟学校原版100%相同.
3、真实使馆认证(即留学人员回国证明),使馆存档可通过大使馆查询确认.
4、留信网认证,国家专业人才认证中心颁发入库证书,留信网存档可查.
《多伦多都会大学学位证购买加拿大毕业证书办理TMU假学历认证》【q微1954292140】学位证1:1完美还原海外各大学毕业材料上的工艺:水印,阴影底纹,钢印LOGO烫金烫银,LOGO烫金烫银复合重叠。文字图案浮雕、激光镭射、紫外荧光、温感、复印防伪等防伪工艺。
高仿真还原加拿大文凭证书和外壳,定制加拿大多伦多都会大学成绩单和信封。学历认证证书电子版TMU毕业证【q微1954292140】办理加拿大多伦多都会大学毕业证(TMU毕业证书)【q微1954292140】毕业证书样本多伦多都会大学offer/学位证学历本科证书、留信官方学历认证(永久存档真实可查)采用学校原版纸张、特殊工艺完全按照原版一比一制作。帮你解决多伦多都会大学学历学位认证难题。
多伦多都会大学offer/学位证、留信官方学历认证(永久存档真实可查)采用学校原版纸张、特殊工艺完全按照原版一比一制作【q微1954292140】Buy Toronto Metropolitan University Diploma购买美国毕业证,购买英国毕业证,购买澳洲毕业证,购买加拿大毕业证,以及德国毕业证,购买法国毕业证(q微1954292140)购买荷兰毕业证、购买瑞士毕业证、购买日本毕业证、购买韩国毕业证、购买新西兰毕业证、购买新加坡毕业证、购买西班牙毕业证、购买马来西亚毕业证等。包括了本科毕业证,硕士毕业证。
ASML provides chip makers with everything they need to mass-produce patterns on silicon, helping to increase the value and lower the cost of a chip. The key technology is the lithography system, which brings together high-tech hardware and advanced software to control the chip manufacturing process down to the nanometer. All of the world’s top chipmakers like Samsung, Intel and TSMC use ASML’s technology, enabling the waves of innovation that help tackle the world’s toughest challenges.
The machines are developed and assembled in Veldhoven in the Netherlands and shipped to customers all over the world. Freerk Jilderda is a project manager running structural improvement projects in the Development & Engineering sector. Availability of the machines is crucial and, therefore, Freerk started a project to reduce the recovery time.
A recovery is a procedure of tests and calibrations to get the machine back up and running after repairs or maintenance. The ideal recovery is described by a procedure containing a sequence of 140 steps. After Freerk’s team identified the recoveries from the machine logging, they used process mining to compare the recoveries with the procedure to identify the key deviations. In this way they were able to find steps that are not part of the expected recovery procedure and improve the process.
Niyi started with process mining on a cold winter morning in January 2017, when he received an email from a colleague telling him about process mining. In his talk, he shared his process mining journey and the five lessons they have learned so far.
The history of a.s.r. begins 1720 in “Stad Rotterdam”, which as the oldest insurance company on the European continent was specialized in insuring ocean-going vessels — not a surprising choice in a port city like Rotterdam. Today, a.s.r. is a major Dutch insurance group based in Utrecht.
Nelleke Smits is part of the Analytics lab in the Digital Innovation team. Because a.s.r. is a decentralized organization, she worked together with different business units for her process mining projects in the Medical Report, Complaints, and Life Product Expiration areas. During these projects, she realized that different organizational approaches are needed for different situations.
For example, in some situations, a report with recommendations can be created by the process mining analyst after an intake and a few interactions with the business unit. In other situations, interactive process mining workshops are necessary to align all the stakeholders. And there are also situations, where the process mining analysis can be carried out by analysts in the business unit themselves in a continuous manner. Nelleke shares her criteria to determine when which approach is most suitable.
保密服务圣地亚哥州立大学英文毕业证书影本美国成绩单圣地亚哥州立大学文凭【q微1954292140】办理圣地亚哥州立大学学位证(SDSU毕业证书)毕业证书购买【q微1954292140】帮您解决在美国圣地亚哥州立大学未毕业难题(San Diego State University)文凭购买、毕业证购买、大学文凭购买、大学毕业证购买、买文凭、日韩文凭、英国大学文凭、美国大学文凭、澳洲大学文凭、加拿大大学文凭(q微1954292140)新加坡大学文凭、新西兰大学文凭、爱尔兰文凭、西班牙文凭、德国文凭、教育部认证,买毕业证,毕业证购买,买大学文凭,购买日韩毕业证、英国大学毕业证、美国大学毕业证、澳洲大学毕业证、加拿大大学毕业证(q微1954292140)新加坡大学毕业证、新西兰大学毕业证、爱尔兰毕业证、西班牙毕业证、德国毕业证,回国证明,留信网认证,留信认证办理,学历认证。从而完成就业。圣地亚哥州立大学毕业证办理,圣地亚哥州立大学文凭办理,圣地亚哥州立大学成绩单办理和真实留信认证、留服认证、圣地亚哥州立大学学历认证。学院文凭定制,圣地亚哥州立大学原版文凭补办,扫描件文凭定做,100%文凭复刻。
特殊原因导致无法毕业,也可以联系我们帮您办理相关材料:
1:在圣地亚哥州立大学挂科了,不想读了,成绩不理想怎么办???
2:打算回国了,找工作的时候,需要提供认证《SDSU成绩单购买办理圣地亚哥州立大学毕业证书范本》【Q/WeChat:1954292140】Buy San Diego State University Diploma《正式成绩单论文没过》有文凭却得不到认证。又该怎么办???美国毕业证购买,美国文凭购买,【q微1954292140】美国文凭购买,美国文凭定制,美国文凭补办。专业在线定制美国大学文凭,定做美国本科文凭,【q微1954292140】复制美国San Diego State University completion letter。在线快速补办美国本科毕业证、硕士文凭证书,购买美国学位证、圣地亚哥州立大学Offer,美国大学文凭在线购买。
美国文凭圣地亚哥州立大学成绩单,SDSU毕业证【q微1954292140】办理美国圣地亚哥州立大学毕业证(SDSU毕业证书)【q微1954292140】录取通知书offer在线制作圣地亚哥州立大学offer/学位证毕业证书样本、留信官方学历认证(永久存档真实可查)采用学校原版纸张、特殊工艺完全按照原版一比一制作。帮你解决圣地亚哥州立大学学历学位认证难题。
主营项目:
1、真实教育部国外学历学位认证《美国毕业文凭证书快速办理圣地亚哥州立大学办留服认证》【q微1954292140】《论文没过圣地亚哥州立大学正式成绩单》,教育部存档,教育部留服网站100%可查.
2、办理SDSU毕业证,改成绩单《SDSU毕业证明办理圣地亚哥州立大学成绩单购买》【Q/WeChat:1954292140】Buy San Diego State University Certificates《正式成绩单论文没过》,圣地亚哥州立大学Offer、在读证明、学生卡、信封、证明信等全套材料,从防伪到印刷,从水印到钢印烫金,高精仿度跟学校原版100%相同.
3、真实使馆认证(即留学人员回国证明),使馆存档可通过大使馆查询确认.
4、留信网认证,国家专业人才认证中心颁发入库证书,留信网存档可查.
《圣地亚哥州立大学学位证书的英文美国毕业证书办理SDSU办理学历认证书》【q微1954292140】学位证1:1完美还原海外各大学毕业材料上的工艺:水印,阴影底纹,钢印LOGO烫金烫银,LOGO烫金烫银复合重叠。文字图案浮雕、激光镭射、紫外荧光、温感、复印防伪等防伪工艺。
高仿真还原美国文凭证书和外壳,定制美国圣地亚哥州立大学成绩单和信封。毕业证网上可查学历信息SDSU毕业证【q微1954292140】办理美国圣地亚哥州立大学毕业证(SDSU毕业证书)【q微1954292140】学历认证生成授权声明圣地亚哥州立大学offer/学位证文凭购买、留信官方学历认证(永久存档真实可查)采用学校原版纸张、特殊工艺完全按照原版一比一制作。帮你解决圣地亚哥州立大学学历学位认证难题。
圣地亚哥州立大学offer/学位证、留信官方学历认证(永久存档真实可查)采用学校原版纸张、特殊工艺完全按照原版一比一制作【q微1954292140】Buy San Diego State University Diploma购买美国毕业证,购买英国毕业证,购买澳洲毕业证,购买加拿大毕业证,以及德国毕业证,购买法国毕业证(q微1954292140)购买荷兰毕业证、购买瑞士毕业证、购买日本毕业证、购买韩国毕业证、购买新西兰毕业证、购买新加坡毕业证、购买西班牙毕业证、购买马来西亚毕业证等。包括了本科毕业证,硕士毕业证。
Fundamentals of Data Analysis, its types, tools, algorithmspriyaiyerkbcsc
Ad
Design and analysis of algorithm in Computer Science
1. UNIT – I
Algorithms and Problem
Solving
ndamtals
Design and Analysis of Algorithms
2. 2
Algorithms
A tool for solving a well-specified
computational problem
Algorithms must be:
Correct: For each input produce an appropriate output
Efficient: run as quickly as possible, and use as little
memory as possible – more about this later
Algorithm
Input Output
3. 3
Algorithms Cont.
A well-defined computational procedure that
takes some value, or set of values, as input and
produces some value, or set of values, as output.
Written in a pseudo code which can be
implemented in the language of programmer’s
choice.
4. 4
Correct and incorrect algorithms
Algorithm is correct if, for every input instance, it ends
with the correct output. We say that a correct algorithm
solves the given computational problem.
An incorrect algorithm might not end at all on some
input instances, or it might end with an answer other
than the desired one.
We shall be concerned only with correct algorithms.
5. 5
Problems and Algorithms
We need to solve a computational problem
“Convert a weight in pounds to Kg”
An algorithm specifies how to solve it, e.g.:
1. Read weight-in-pounds
2. Calculate weight-in-Kg = weight-in-pounds *
0.455
3. Print weight-in-Kg
A computer program is a computer-
executable description of an algorithm
7. 7
From Algorithms to Programs
Problem
C++ Program
C++ Program
Algorithm
Algorithm: A sequence
of instructions describing
how to do a task (or
process)
8. •Algorithms as technology
•hardware with high clock rates, pipelining, and
superscalar architectures
•easy-to-use, intuitive graphical user interfaces (GUIs),
•object-oriented systems
•local-area and wide-area networking.
9. Classification of problem
Types:
1) Problems based on Algorithmic Solutions:
Include Step by step Instructions and Series of actions
eg: To find fibonacci series – Sequence of steps/actions are
required.
2) Problems based on Heuristic Solutions:
Trial and Error form
No sequence of actions or instructions
eg: Decision of which stock should I buy?
11. Problem Solving Strategies
• 1) Divide and conquer: A divide-and-conquer algorithm works by
recursively breaking down a problem into two or more sub-problems of the
same or related type, until these become simple enough to be solved directly.
• Eg: Binary search, Merge sort, Quick sort
• 2) Greedy method: The greedy approach is an algorithm strategy in
which a set of resources are recursively divided based on the maximum,
immediate availability of that resource at any given stage of execution. To solve
a problem based on the greedy approach, there are two stages. scanning the
list of items. optimization.
• Eg: Knapsack Problem, Job scheduling with deadlines.
12. Problem Solving Strategies
• 3) Dynamic programming: Dynamic Programming is mainly an
optimization over plain recursion. Wherever we see a recursive solution that
has repeated calls for same inputs, we can optimize it using Dynamic
Programming. The idea is to simply store the results of subproblems, so that
we do not have to re-compute them when needed later.
• Eg: 0/1 Knapsack problem, Optimum Binary Search Tree, Travelling salesman
problem
• 4) Trial and error: Trial And Error. Trial and error is a problem solving
method in which multiple attempts are made to reach a solution. It is a basic
method of learning that essentially all organisms use to learn new behaviors.
Trial and error is trying a method, observing if it works, and if it doesn't trying a
new method.
• Eg: Printer not working problem: check ink level or check paper tray jamming
13. 13
Practical Examples
Internet and Networks
The need to access large amount of information with the
shortest time.
Problems of finding the best routs for the data to travel.
Algorithms for searching this large amount of data to quickly
find the pages on which particular information resides.
Electronic Commerce
The ability of keeping the information (credit card numbers,
passwords, bank statements) private, safe, and secure.
Algorithms involves encryption/decryption techniques.
14. 14
Hard problems
We can identify the Efficiency of an algorithm
from its speed (how long does the algorithm take
to produce the result).
Some problems have unknown efficient solution.
These problems are called NP-complete problems.
If we can show that the problem is NP-complete,
we can spend our time developing an efficient
algorithm that gives a good, but not the best
possible solution.
15. 15
Components of an Algorithm
Variables and values
Instructions
Sequences
A series of instructions
Procedures
A named sequence of instructions
we also use the following words to refer to a
“Procedure” :
Sub-routine
Module
Function
16. 16
Components of an Algorithm Cont.
Selections
An instruction that decides which of two possible
sequences is executed
The decision is based on true/false condition
Repetitions
Also known as iteration or loop
Documentation
Records what the algorithm does
18. Classification of Time Complexities
•Constant Time Complexity: O(1) ...
•Linear Time Complexity: O(n) ...
•Logarithmic Time Complexity: O(log n) ...
•Quadratic Time Complexity: O(n²) ...
•Exponential Time Complexity: O(2^n)
19. Asymptotic Notation ( Ο Ω Θ )
[Big “oh” ] : This notation is used to express an upper bound on
computing time of an algorithm. When we say that time complexity
of Selection sort algorithm is Ο(n2
) , means that for sufficiently large
values of ‘n’ , computation time will not exceed some constant time *
n2
i.e proportional to n2
(Worst Case).
20. [Big “oh”] Ο
• Definition : The function f(n) = Ο( g(n) ) (read as “f of n is
big oh of g of n”) iff (if and only if ) there exist positive
constants c and n0 such that f(n) <= c * g(n) for all n, n
>= n0.
• Example:
• The function 3n+2 = Ο(n) as 3n + 2 <= 4n for all n >= 2
• The function 3n+3 = Ο(n) as 3n + 3 <= 4n for all n >= 3
• The function 100n+6 = Ο(n) as 100n + 6 <= 101n for all n
>= 6
• The function 10n2
+4n+2 = Ο(n2
) as 10n2
+4n+2 <= 11n2
for
all n >= 5
• The function 1000n2
+100n-6 = Ο(n2
) as 1000n2
+100n-6
<= 1001n2
for all n >= 100
• The function 6*2n
+ n2
= Ο(2n
) as 6*2n
+ n2
<= 7*2n
for all
n >= 4
21. [Omega] Ω
This notation is used to express an lower bound on computing time
of an algorithm. When we say that best case time complexity of
insertion sort is Ω (n), means that for sufficiently large values of ‘n’,
minimum computation time will be some constant time * n i.e
proportional to n.
22. [Omega] Ω
• Definition : The function f(n) = Ω( g(n) ) (read as “f of n is
omega of g of n”) iff there exist positive constants c and n0
such that f(n) >= c * g(n) for all n, n >= n0.
• Example:
• The function 3n+2 = Ω (n) as 3n + 2 >= 3n for all n >= 1
• The function 3n+3 = Ω (n) as 3n + 3 >= 3n for all n >= 1
• The function 100n+6 = Ω (n) as 100n + 6 >= 100n for all n
>= 1
• The function 10n2
+4n+2 = Ω (n2
) as 10n2
+4n+2 >= n2
for all
n >= 1
• The function 6*2n
+ n2
= Ω (2n
) as 6*2^n + n2
>= 2n
for all n
>= 1
23. [Theta] Θ
•This notation is used to express time complexity of
an algorithm when it is same for worst & Best cases.
For example best and worst case time complexities
for selection sort is Ο(n2
) & Ω (n2
) i.e. it can be
expressed as Θ (n2
).
•Definition : The function f(n) = Θ( g(n) ) (read as “f of
n is theta of g of n”) iff there exist positive constants
c1, c2 and n0 such that c1 *g(n) <= f(n) <= c2 * g(n)
for all n, n >= n0.
24. • Example:
• The function 3n+2 = Θ (n) as 3n + 2 >= 3n for all n >= 2 and 3n + 2 <=
4n for all n >= 2.
• The function 3n+3 = Θ (n)
• The function 10n2
+4n+2 = Θ (n2
)
• The function 6*2n
+ n2
= Θ (2n
)
25. • Proving the Correctness of Algorithms
• Preconditions and Postconditions
• Loop Invariants
• Induction – Math Review
• Using Induction to Prove Algorithms
26. What does an algorithm ?
•An algorithm is described by:
• Input data
• Output data
• Preconditions: specifies restrictions on input data
• Postconditions: specifies what is the result
•Example: Binary Search
• Input data: a:array of integer;
x:integer;
• Output data: found:boolean;
• Precondition: a is sorted in ascending order
• Postcondition: found is true if x is in a, and found
is false otherwise
27. Correct algorithms
• An algorithm is correct if:
• for any correct input data:
•it stops and
•it produces correct output.
•Correct input data: satisfies precondition
•Correct output data: satisfies postcondition
28. Proving correctness
• An algorithm = a list of actions
• Proving that an algorithm is totally
correct:
1. Proving that it will terminate
2. Proving that the list of actions applied to the
precondition imply the postcondition
• This is easy to prove for simple sequential
algorithms
• This can be complicated to prove for repetitive
algorithms (containing loops or recursivity)
• use techniques based on loop invariants and induction
29. Example – a sequential
algorithm
Swap1(x,y):
aux := x
x := y
y := aux
Precondition:
x = a and y = b
Postcondition:
x = b and y = a
Proof: the list of actions
applied to the
precondition imply the
postcondition
1. Precondition:
x = a and y = b
2. aux := x => aux = a
3. x : = y => x = b
4. y := aux => y = a
5. x = b and y = a is
the Postcondition
30. Example – a repetitive
algorithm
Algorithm Sum_of_N_numbers
Input: a, an array of N numbers
Output: s, the sum of the N numbers
in a
s:=0;
k:=0;
While (k<N) do
k:=k+1;
s:=s+a[k];
end
Proof: the list of actions
applied to the
precondition imply
the postcondition
BUT: we cannot
enumerate all the
actions in case of a
repetitive
algorithm !
We use techniques
based on loop
invariants and
induction
31. Loop invariants
•A loop invariant is a logical predicate such
that: if it is satisfied before entering any
single iteration of the loop then it is also
satisfied after the iteration
32. Example: Loop invariant for
Sum of n numbers
Algorithm Sum_of_N_numbers
Input: a, an array of N numbers
Output: s, the sum of the N numbers in a
s:=0;
k:=0;
While (k<N) do
k:=k+1;
s:=s+a[k];
end
Loop invariant = induction
hypothesis: At step k, S holds the
sum of the first k numbers
33. Using loop invariants in proofs
• We must show the following 3 things
about a loop invariant:
1. Initialization: It is true prior to the first
iteration of the loop.
2. Maintenance: If it is true before an
iteration of the loop, it remains true
before the next iteration.
3. Termination: When the loop terminates,
the invariant gives us a useful property
that helps show that the algorithm is
correct.
34. Example: Proving the
correctness of the Sum
algorithm (1)
• Induction hypothesis: S= sum of the first k
numbers
1. Initialization: The hypothesis is true at the
beginning of the loop:
Before the first iteration: k=0, S=0. The first 0 numbers
have sum zero (there are no numbers) =>
hypothesis true before entering the loop
35. Example: Proving the
correctness of the Sum
algorithm (2)
• Induction hypothesis: S= sum of the first k numbers
2. Maintenance: If hypothesis is true before step k, then it will
be true before step k+1 (immediately after step k is
finished)
We assume that it is true at beginning of step k: “S is the sum of the first k
numbers”
We have to prove that after executing step k, at the beginning of step k+1:
“S is the sum of the first k+1 numbers”
We calculate the value of S at the end of this step
K:=k+1, s:=s+a[k+1] => s is the sum of the first k+1 numbers
36. Example: Proving the
correctness of the Sum
algorithm (3)
• Induction hypothesis: S= sum of the first k
numbers
3. Termination: When the loop terminates,
the hypothesis implies the correctness of
the algorithm
The loop terminates when k=n=> s= sum of
first k=n numbers => postcondition of
algorithm, DONE
37. Loop invariants and induction
• Proving loop invariants is similar to mathematical
induction:
• showing that the invariant holds before the first iteration corresponds to the
base case, and
• showing that the invariant holds from iteration to iteration corresponds to
the inductive step.
38. Mathematical induction -
Review
• Let T be a theorem that we want to
prove. T includes a natural parameter n.
• Proving that T holds for all natural
values of n is done by proving following
two conditions:
1. T holds for n=1
2. For every n>1 if T holds for n-1, then T holds for n
Terminology:
T= Induction Hypothesis
1= Base case
2= Inductive step
39. Mathematical induction -
Review
• Strong Induction: a variant of induction
where the inductive step builds up on all
the smaller values
• Proving that T holds for all natural
values of n is done by proving following
two conditions:
1. T holds for n=1
2. For every n>1 if T holds for all k<= n-1, then T holds for n
40. Mathematical induction review –
Example1
• Theorem: The sum of the first n natural
numbers is n*(n+1)/2
• Proof: by induction on n
1. Base case: If n=1, s(1)=1=1*(1+1)/2
2. Inductive step: We assume that s(n)=n*(n+1)/2,
and prove that this implies s(n+1)=(n+1)*(n+2)/2 ,
for all n>=1
s(n+1)=s(n)+(n+1)=n*(n+1)/2+(n+1)=(n+1)*(n+2)/2
41. Mathematical induction review –
Example2
•Theorem: Every amount of postage that is at
least 12 cents can be made from 4-cent and
5-cent stamps.
•Proof: by induction on the amount of postage
• Postage (p) = m * 4 + n * 5
• Base case:
• Postage(12) = 3 * 4 + 0 * 5
• Postage(13) = 2 * 4 + 1 * 5
• Postage(14) = 1 * 4 + 2 * 5
• Postage(15) = 0 * 4 + 3 * 5
42. Mathematical induction review –
Example2 (cont)
• Inductive step: We assume that we can construct
postage for every value from 12 up to k. We need
to show how to construct k + 1 cents of postage.
Since we have proved base cases up to 15 cents,
we can assume that k + 1 16.
≥
• Since k+1 16, (k+1) 4 12. So by the inductive
≥ − ≥
hypothesis, we can construct postage for (k + 1)
4 cents: (k + 1) 4 = m * 4+ n * 5
− −
• But then k + 1 = (m + 1) * 4 + n * 5. So we can
construct k + 1 cents of postage using (m+1) 4-
cent stamps and n 5-cent stamps
43. Correctness of algorithms
• Induction can be used for proving the correctness of
repetitive algorithms:
• Iterative algorithms:
• Loop invariants
• Induction hypothesis = loop invariant = relationships between the variables during loop
execution
• Recursive algorithms
• Direct induction
• Hypothesis = a recursive call itself ; often a case for applying strong induction
44. Example: Correctness proof
for Decimal to Binary
Conversion
Algorithm Decimal_to_Binary
Input: n, a positive integer
Output: b, an array of bits, the bin repr. of n,
starting with the least significant bits
t:=n;
k:=0;
While (t>0) do
k:=k+1;
b[k]:=t mod 2;
t:=t div 2;
end
It is a repetitive (iterative)
algorithm, thus we use loop
invariants and proof by induction
45. Example: Loop invariant for
Decimal to Binary Conversion
Algorithm Decimal_to_Binary
Input: n, a positive integer
Output: b, an array of bits, the bin repr. of n
t:=n;
k:=0;
While (t>0) do
k:=k+1;
b[k]:=t mod 2;
t:=t div 2;
end
At step k, b holds the k least
significant bits of n, and the value
of t, when shifted by k,
corresponds to the rest of the bits
b
1 2 3 k
20
21
22
2k-1
46. Example: Loop invariant for
Decimal to Binary Conversion
Algorithm Decimal_to_Binary
Input: n, a positive integer
Output: b, an array of bits, the bin repr. of n
t:=n;
k:=0;
While (t>0) do
k:=k+1;
b[k]:=t mod 2;
t:=t div 2;
end
Loop invariant: If m is the
integer represented by array
b[1..k], then n=t*2k
+m
b
1 2 3 k
20
21
22
2k-1
47. Example: Proving the
correctness of the
conversion algorithm
• Induction hypothesis=Loop Invariant:
If m is the integer represented by array
b[1..k], then n=t*2^k+m
• To prove the correctness of the
algorithm, we have to prove the 3
conditions:
1. Initialization: The hypothesis is true at the
beginning of the loop
2. Maintenance: If hypothesis is true for step k, then
it will be true for step k+1
3. Termination: When the loop terminates, the
hypothesis implies the correctness of the
algorithm
48. Example: Proving the
correctness of the
conversion algorithm (1)
• Induction hypothesis: If m is the integer
represented by array b[1..k], then
n=t*2^k+m
1. The hypothesis is true at the beginning of
the loop:
k=0, t=n, m=0(array is empty)
n=n*2^0+0
49. Example: Proving the
correctness of the
conversion algorithm (2)
• Induction hypothesis: If m is the integer
represented by array b[1..k], then n=t*2^k+m
2. If hypothesis is true for step k, then it will be true
for step k+1
At the start of step k: assume that n=t*2^k+m, calculate the
values at the end of this step
If t=even then: t mod 2==0, m unchanged, t=t / 2, k=k+1=> (t /
2) * 2 ^ (k+1) + m = t*2^k+m=n
If t=odd then: t mod 2 ==1, b[k+1] is set to 1, m=m+2^k , t=(t-
1)/2, k=k+1 => (t-1)/2*2^(k+1)+m+2^k=t*2^k+m=n
50. Example: Proving the
correctness of the
conversion algorithm (3)
• Induction hypothesis: If m is the integer
represented by array b[1..k], then
n=t*2^k+m
3. When the loop terminates, the hypothesis
implies the correctness of the algorithm
The loop terminates when t=0 =>
n=0*2^k+m=m
n==m, proved
51. Proof of Correctness for
Recursive Algorithms
• In order to prove recursive algorithms,
we have to:
1. Prove the partial correctness (the fact that the
program behaves correctly)
• we assume that all recursive calls with arguments that
satisfy the preconditions behave as described by the
specification, and use it to show that the algorithm
behaves as specified
2. Prove that the program terminates
• any chain of recursive calls eventually ends and all loops, if
any, terminate after some finite number of iterations.
52. Example - Merge Sort
MERGE-SORT(A,p,r)
if p < r
q= (p+r)/2
MERGE-SORT(A,p,q)
MERGE-SORT(A,q+1,r)
MERGE(A,p,q,r)
Precondition:
Array A has at least 1 element between
indexes p and r (p<=r)
Postcondition:
The elements between indexes p and r are
sorted
p r
q
53. Correctness proofs
for recursive algorithms
• Base Case: Prove that RECURSIVE works for n = small_value
• Inductive Hypothesis:
• Assume that RECURSIVE works correctly for n=small_value, ..., k
• Inductive Step:
• Show that RECURSIVE works correctly for n = k + 1
RECURSIVE(n) is
if (n=small_value)
return ct
else
RECURSIVE(n1)
…
RECURSIVE(nr)
some_code
n1, n2, … nr are some
values smaller than n but
bigger than small_value
54. •Proving that an algorithm is totally
correct means:
1.Proving that it will terminate
2.Proving that the list of actions applied to the
precondition imply the postcondition
•How to prove repetitive algorithms:
• Iterative algorithms: use Loop invariants, Induction
• Recursive algorithms: use induction using as
hypothesis the recursive call