Trying to understand Big-o notation
source link: https://www.codesd.com/item/trying-to-understand-big-o-notation.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Trying to understand Big-o notation
Hi I would really appreciate some help with Big-O notation. I have an exam in it tomorrow and while I can define what f(x) is O(g(x)) is, I can't say I thoroughly understand it.
The following question ALWAYS comes up on the exam and I really need to try and figure it out, the first part seems easy (I think) Do you just pick a value for n, compute them all on a claculator and put them in order? This seems to easy though so I'm not sure. I'm finding it very hard to find examples online.
From lowest to highest, what is the correct order of the complexities O(n2), O(log2 n), O(1), O(2n), O(n!), O(n log2 n)?
What is the worst-case computational-complexity of the Binary Search algorithm on an ordered list of length n = 2k?
From lowest to highest, what is the correct order of the complexities O(n2), O(log2 n), O(1), O(2n), O(n!), O(n log2 n)?
The order is same as if you compare their limit at infinity. like lim(a/b)
, if it is 1, then they are same, inf. or 0 means one of them is faster.
What is the worst-case computational-complexity of the Binary Search algorithm on an ordered list of length n = 2k?
- Find binary search best/worst Big-O.
- Find linked list access by index best/worst Big-O.
- Make conclusions.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK