I'm working on homework assignments for my C++ class, and one major part of many assignments is Big-O notation. My problem is that I just don't get it. Are there any really good sources that gives a "for dummies" approach to Big-O notation?
I'm working on homework assignments for my C++ class, and one major part of many assignments is Big-O notation. My problem is that I just don't get it. Are there any really good sources that gives a "for dummies" approach to Big-O notation?
I think the one on this very site is quiet good. I actually understood most of it from here, and them just filled in the blanks from a few google searches.
http://www.cprogramming.com/tutorial...ficiency1.html
Originally Posted by brewbuck:
Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
The general idea is that some things get waaaay more complicated as the number of "things" increases.My problem is that I just don't get it.
For example, if you want to sort a list of names into alphabetical order - It might take more than twice as long to sort 20 names as it does to sort 10 names... How much longer? Big-O will tell you.
That's just the general idea to get you started... If you turn that in for your homework, you might get a 'D'... if you are lucky.
That's a helpful explanation actually. Thank you for that.
I want to make one thing clear. My homework isn't "What is Big O?" Rather it is "using Big O, determine the complexity of C++ function T." I'm not looking for anyone to do function T for me. I just want to know how to do Big O. I hope that helps everyone know where I'm coming from.
Hypothetical situation:
Let's say I have a vector of 20 random integers (non-sorted) and I need to perform a selection sort on it. How would a programmer go from this given information, and do a Big O analysis?
Well first he would need to look at the source code itself, or at least have an idea of how a selection sort is performed. Nothing like having the actual code in front of him or some equivalent pseudo-code to better visualize the algorithm.
Then he just follows the steps delineated on the link I provided you with earlier.
Originally Posted by brewbuck:
Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.