I've been learning more about Big O Notation and how to calculate it based on how an algorithm is written. I came across an interesting set of rules for calculating an algorithms Big O notation and I wanted to see if I'm on the right track or way off.Big O Notation: Nfunction(n) {    For(var a = 0; i <= n; i++) { // It's N because it's just a single loop        // Do stuff    }}Big O Notation: N2function(n, b) {    For(var a = 0; a <= n; a++) {        For(var c = 0; i <= b; c++) { // It's N squared because it's two nested loops            // Do stuff        }    }}Big O Notation: 2Nfunction(n, b) {    For(var a = 0; a <= n; a++) {        // Do stuff    }    For(var c = 0; i <= b; c++) { // It's 2N the loops are outside each other        // Do stuff    }}Big O Notation: NLogNfunction(n) {    n.sort(); // The NLogN comes from the sort?    For(var a = 0; i <= n; i++) {        // Do stuff    }}Are my examples and the subsequent notation correct? Are there additional notations I should be aware of?
Is this a Proper Rule for Identifying the Big O Notation of an Algorithm?
algorithms;big o
Formally, big-O notation describes the degree of complexity. To calculate big-O notation:identify formula for algorithm complexity. Let's say, for example, two loops with another one nested inside, then another three loops not nested: 2N + 3Nremove everything except the highest term: 2Nremove all constants: N In other words two loops with another one nested inside, then another three loops not nested is O(N)This of course assumes that what you have in your loops are simple instructions. If you have for example sort() inside the loop, you'll have to multiply complexity of the loop by the complexity of the sort() implementation your underlying language/library is using. 