Download presentation
Presentation is loading. Please wait.
Published byAllan Baldwin Modified over 9 years ago
2
Analysis of algorithms Analysis of algorithms is the branch of computer science that studies the performance of algorithms, especially their run time and space requirements. The practical goal of algorithm analysis is to predict the performance of different algorithms in order to guide design decisions. So the goal of algorithm analysis is to make meaningful comparisons between algorithms.
3
Run-time analysis Run-time analysis is a theoretical classification that estimates and anticipates the increase in running time (or run-time) of an algorithm as its input size (usually denoted as n) increases. running timealgorithm input size Run-time efficiency is a topic of great interest in computer science: A program can take seconds, hours or even years to finish executing, depending on which algorithm it implements (performance analysis, which is the analysis of an algorithm's run-time in practice). computer scienceprogramperformance analysis
4
Algorithm's Performance Two important ways to characterize the effectiveness of an algorithm are its space complexity and time complexity. Time complexity of an algorithm concerns determining an expression of the number of steps needed as a function of the problem size.
5
Algorithm's Performance There are two aspects of algorithmic performance: Time - Instructions take time. - How fast does the algorithm perform? - What affects its runtime? Space - Data structures take space - What kind of data structures can be used? -How does choice of data structure affect the runtime?
6
Algorithm Analysis The complexity of an algorithm is a function g(n) that gives the upper bound of the number of operation (or running time) performed by an algorithm when the input size is n.
7
Algorithm Analysis There are two interpretations of upper bound. Worst-case Complexity The running time for any given size input will be lower than the upper bound except possibly for some values of the input where the maximum is reached. Average-case Complexity The running time for any given size input will be the average number of operations over all problem instances for a given size.
8
Types of algorithms The performance of algorithms also depend on the nature of algorithms ( the type of problem). Different analysis methods are used for each algorithm. There are variety of algorithms present in different groups. Random Algorithms
9
Another approach to some problems is to randomize an algorithm is some way. While doing so does not improve the algorithm in the worst case, it often makes very good algorithms in the average case.
10
Compression This class of algorithm deals with situations such as data compression. This type of algorithm does not have an expected output (like a sorting algorithm), but instead tries to optimize some other criteria. In the case of data compression algorithm tries to make the data use as few bytes as possible, in such a way that it can be decompressed to its original form.
11
Divide-and-Conquer Algorithm Divide-and-conquer is a top-down technique for designing algorithms that consists of dividing the problem into smaller sub- problems hoping that the solutions of the sub- problems are easier to find and then composing the partial solutions into the solution of the original problem.
12
Sorting The objective of the sorting algorithm is to rearrange the records so that their keys are ordered according to some well-defined ordering rule. Problem: Given an array of n real number A[1.. n]. Objective: Sort the elements of A in ascending order of their values.
13
Approximate Algorithms An approximate algorithm is a way of dealing with NP-completeness for optimization problem. This technique does not guarantee the best solution. The goal of an approximation algorithm is to come as close as possible to the optimum value in a reasonable amount of time which is at most polynomial time.
14
Geometric algorithms Geometric algorithms concern the management of complex objects. The machine language level cannot handle these complex objects. Therefore, the algorithm designer must organize these objects by means of the simpler data types directly represent able by the computer. Data structures refer to these organizations.
15
Greedy algorithms Greedy algorithms are simple and straightforward. They are shortsighted in their approach in the sense that they take decisions on the basis of information at hand without worrying about the effect these decisions may have in the future. They are easy to invent, easy to implement and most of the time quite efficient.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.