When to use big O notation and when to use big Theta notation
I understand that Big O is an upper bound and Big Theta is a tight bound when for example we consider the functions f(n)=O(g(n)) or similarly for Big Theta. But how do we know that a particular algorithm will be better represented using the Big theta notation instead of Big O?
For example, the time complexity of selection sort is given as Big Theta of N^2 rather than Big O of N^2, why?
It's not a question of which is better but rather what do you want to studies. If you want to study the worst case scenario then you can use the upper bound notation. Keep in mind that the tighter the bound the better, but in some cases it's difficult to calculate the tight bound. Generally, when people speak about big-O or big-teta they mean the same think so in Selection sort you can also use big-O notation
链接地址: http://www.djcxy.com/p/40126.html上一篇: 手动下载模拟器的系统映像