Skip to content

Commit

Permalink
fix(book/array): improve examples and grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
amejiarosario committed Oct 17, 2020
1 parent 29f374a commit 04836cd
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 107 deletions.
7 changes: 3 additions & 4 deletions book/content/part01/algorithms-analysis.asc
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@ Before going deeper into space and time complexity, let's cover the basics real

Algorithms (as you might know) are steps of how to do some tasks. When you cook, you follow a recipe (or an algorithm) to prepare a dish. Let's say you want to make a pizza.

.Example of an algorithm
.Example of an algorithm to make pizza
[source, javascript]
----
import { punchDown, rollOut, applyToppings, Oven } from '../pizza-utils';
import { rollOut, applyToppings, Oven } from '../pizza-utils';
function makePizza(dough, toppings = ['cheese']) {
const oven = new Oven(450);
const punchedDough = punchDown(dough);
const rolledDough = rollOut(punchedDough);
const rolledDough = rollOut(dough);
const rawPizza = applyToppings(rolledDough, toppings);
const pizzaPromise = oven.bake(rawPizza, { minutes: 20 });
return pizzaPromise;
Expand Down
1 change: 1 addition & 0 deletions book/content/part01/how-to-big-o.asc
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ T(n) = n * [t(statement 1) + m * t(statement 2...3)]
Assuming the statements from 1 to 3 are `O(1)`, we would have a runtime of `O(n * m)`.
If instead of `m`, you had to iterate on `n` again, then it would be `O(n^2)`. Another typical case is having a function inside a loop. Let's see how to deal with that next.

[[big-o-function-statement]]
*Function call statements*

When you calculate your programs' time complexity and invoke a function, you need to be aware of its runtime. If you created the function, that might be a simple inspection of the implementation. However, if you are using a library function, you might infer it from the language/library documentation.
Expand Down
Loading

0 comments on commit 04836cd

Please sign in to comment.