# Difference between Posteriori and Priori analysis

Prerequisite – Analysis of Algorithms

Algorithm is a combination or sequence of finite-state to solve a given problem. If the problem is having more than one solution or algorithm then the best one is dicided by the analysis based on two factors.

- CPU Time (Time Complexity)
- Main memory space (Space Complexity)

Time complexity of an algorithm can be calculated by using two methods:

- Posteriori Analysis
- Priori Analysis

**Difference between Aposteriori analysis and A Priori analysis:**

A Posteriori analysis | A priori analysis |
---|---|

Posteriori analysis is a relative analysis. | Piori analysis is an absolute analysis. |

It is dependent on language of compiler and type of hardware. | It is independent of language of compiler and types of hardware. |

It will give exact answer. | It will give approximate answer. |

It doesn’t use asymptotic notations to represent the time complexity of an algorithm. | It uses the asymptotic notations to represent how much time the algorithm will take in order to complete its execution. |

The time complexity of an algorithm using a posteriori analysis differ from system to system. | The time complexity of an algorithm using a priori analysis is same for every system. |

If the time taken by the algorithm is less, then the credit will go to compiler and hardware. | If the program running faster, credit goes to the programmer. |

Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.

## Recommended Posts:

- Analysis of Algorithm | Set 5 (Amortized Analysis Introduction)
- Analysis of Algorithms | Set 1 (Asymptotic Analysis)
- Analysis of Algorithms | Set 4 (Analysis of Loops)
- Analysis of Algorithms | Big-O analysis
- FIRST Set in Syntax Analysis
- FOLLOW Set in Syntax Analysis
- Introduction of Lexical Analysis
- Analysis of different sorting techniques
- Analysis of algorithms | little o and little omega notations
- Complexity Analysis of Binary Search
- Data flow analysis in Compiler
- Amortized analysis for increment in counter
- Analysis of Algorithms | Set 3 (Asymptotic Notations)
- Semantic Analysis in Compiler Design
- Analysis of Algorithm | Set 4 (Solving Recurrences)
- Analysis of Algorithms | Set 5 (Practice Problems)
- Complexity analysis of various operations of Binary Min Heap
- Practice Questions on Time Complexity Analysis
- Introduction to Syntax Analysis in Compiler Design
- Analysis and Design of Combinational and Sequential circuits

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.