📜  后验与先验分析之间的区别

📅  最后修改于: 2021-05-08 18:17:38             🧑  作者: Mango

先决条件–算法分析
算法是有限状态的组合或序列,用于解决给定的问题。如果问题有多个解决方案或算法,则基于两个因素的分析将最好的解决方案或算法排除在外。

  1. CPU时间(时间复杂度)
  2. 主内存空间(空间复杂度)

可以使用两种方法来计算算法的时间复杂度:

  1. 后验分析
  2. 先验分析

后验分析与先验分析之间的区别:

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.