diff options
-rw-r--r-- | asymptotic-notation.html.markdown | 12 | ||||
-rw-r--r-- | git.html.markdown | 3 | ||||
-rw-r--r-- | ruby.html.markdown | 17 |
3 files changed, 22 insertions, 10 deletions
diff --git a/asymptotic-notation.html.markdown b/asymptotic-notation.html.markdown index deb3e37d..e1f961f8 100644 --- a/asymptotic-notation.html.markdown +++ b/asymptotic-notation.html.markdown @@ -66,8 +66,8 @@ Polynomial - n^z, where z is some constant Exponential - a^n, where a is some constant ``` -### Big-Oh -Big-Oh, commonly written as O, is an Asymptotic Notation for the worst case, or ceiling of growth +### Big-O +Big-O, commonly written as O, is an Asymptotic Notation for the worst case, or ceiling of growth for a given function. Say `f(n)` is your algorithm runtime, and `g(n)` is an arbitrary time complexity you are trying to relate to your algorithm. `f(n)` is O(g(n)), if for any real constant c (c > 0), `f(n)` <= `c g(n)` for every input size n (n > 0). @@ -81,7 +81,7 @@ g(n) = log n Is `f(n)` O(g(n))? Is `3 log n + 100` O(log n)? -Let's look to the definition of Big-Oh. +Let's look to the definition of Big-O. ``` 3log n + 100 <= c * log n @@ -93,7 +93,7 @@ Is there some constant c that satisfies this for all n? 3log n + 100 <= 150 * log n, n > 2 (undefined at n = 1) ``` -Yes! The definition of Big-Oh has been met therefore `f(n)` is O(g(n)). +Yes! The definition of Big-O has been met therefore `f(n)` is O(g(n)). *Example 2* @@ -104,7 +104,7 @@ g(n) = n Is `f(n)` O(g(n))? Is `3 * n^2` O(n)? -Let's look at the definition of Big-Oh. +Let's look at the definition of Big-O. ``` 3 * n^2 <= c * n @@ -119,7 +119,7 @@ for a given function. `f(n)` is Ω(g(n)), if for any real constant c (c > 0), `f(n)` is >= `c g(n)` for every input size n (n > 0). -Feel free to head over to additional resources for examples on this. Big-Oh is the primary notation used +Feel free to head over to additional resources for examples on this. Big-O is the primary notation used for general algorithm time complexity. ### Ending Notes diff --git a/git.html.markdown b/git.html.markdown index 04350dd5..af65afb0 100644 --- a/git.html.markdown +++ b/git.html.markdown @@ -217,6 +217,9 @@ the changes made and a message created by the user. ```bash # commit with a message $ git commit -m "Added multiplyNumbers() function to HelloWorld.c" + +# automatically stage modified or deleted files, except new files, and then commit +$ git commit -a -m "Modified foo.php and removed bar.php" ``` ### diff diff --git a/ruby.html.markdown b/ruby.html.markdown index 7cf5bdc7..1883d1ad 100644 --- a/ruby.html.markdown +++ b/ruby.html.markdown @@ -60,8 +60,6 @@ false.class #=> FalseClass # Inequality 1 != 1 #=> false 2 != 1 #=> true -!true #=> false -!false #=> true # apart from false itself, nil is the only other 'falsey' value @@ -75,6 +73,17 @@ false.class #=> FalseClass 2 <= 2 #=> true 2 >= 2 #=> true +# Logical operators +true && false #=> false +true || false #=> true +!true #=> false + +# Alternate spellings of logical operators +true and false #=> false +true or false #=> true +not true #=> false + + # Strings are objects 'I am a string'.class #=> String @@ -280,9 +289,9 @@ rescue NoMemoryError => exception_variable puts 'NoMemoryError was raised', exception_variable rescue RuntimeError => other_exception_variable puts 'RuntimeError was raised now' -else +else puts 'This runs if no exceptions were thrown at all' -ensure +ensure puts 'This code always runs no matter what' end |