Skip to content

Commit 603afc2

Browse files
authoredOct 19, 2020
Merge pull request amejiarosario#88 from amejiarosario/feat/arrays
Array Patterns and Examples
2 parents f7ebb75 + 8fa2746 commit 603afc2

10 files changed

+304
-107
lines changed
 

‎.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ local.properties
8686
######################
8787
# Windows image file caches
8888
Thumbs.db
89+
*Zone.Identifier
8990

9091
# Folder config file
9192
Desktop.ini

‎book/content/part01/algorithms-analysis.asc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,14 @@ Before going deeper into space and time complexity, let's cover the basics real
2828

2929
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.
3030

31-
.Example of an algorithm
31+
.Example of an algorithm to make pizza
3232
[source, javascript]
3333
----
34-
import { punchDown, rollOut, applyToppings, Oven } from '../pizza-utils';
34+
import { rollOut, applyToppings, Oven } from '../pizza-utils';
3535
3636
function makePizza(dough, toppings = ['cheese']) {
3737
const oven = new Oven(450);
38-
const punchedDough = punchDown(dough);
39-
const rolledDough = rollOut(punchedDough);
38+
const rolledDough = rollOut(dough);
4039
const rawPizza = applyToppings(rolledDough, toppings);
4140
const pizzaPromise = oven.bake(rawPizza, { minutes: 20 });
4241
return pizzaPromise;

‎book/content/part01/how-to-big-o.asc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ T(n) = n * [t(statement 1) + m * t(statement 2...3)]
111111
Assuming the statements from 1 to 3 are `O(1)`, we would have a runtime of `O(n * m)`.
112112
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.
113113

114+
[[big-o-function-statement]]
114115
*Function call statements*
115116

116117
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.

‎book/content/part02/array.asc

Lines changed: 294 additions & 99 deletions
Large diffs are not rendered by default.
649 Bytes
Loading

‎book/images/max-sum-backtracking.png

27.8 KB
Loading
5.77 KB
Loading
2.65 KB
Loading
166 KB
Loading

‎book/part02-linear-data-structures.asc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
[[part02-linear-data-structures]]
22
== Linear Data Structures
33

4-
Data Structures comes in many flavors. Theres no one to rule them all. You have to know the tradeoffs so you can choose the right one for the job.
4+
Data Structures come in many flavors. There's no one to rule them all. You have to know the tradeoffs so you can choose the right one for the job.
55

6-
Even though in your day-to-day, you might not need to re-implementing them, knowing how they work internally would help you know when to use one over the other or even tweak them to create a new one. We are going to explore the most common data structures' time and space complexity.
6+
In your day-to-day work, you might not need to re-implement basic data structures. However, knowing how they work internally can help you understand their time complexity better (Remember the chapter <<big-o-function-statement, How to determine Big-O from code?>>).
7+
8+
When you are aware of the data structures implementations, you spot when to use one over the other or even extend them to create a new one. We are going to explore the most common data structures' time and space complexity.
79

810
.In this part we are going to learn about the following linear data structures:
911
- <<array-chap>>
@@ -22,6 +24,7 @@ If you want to have a general overview of each one, take a look at the following
2224
+++
2325
endif::[]
2426

27+
<<<
2528
include::content/part02/array.asc[]
2629

2730
<<<
@@ -35,5 +38,3 @@ include::content/part02/queue.asc[]
3538

3639
<<<
3740
include::content/part02/array-vs-list-vs-queue-vs-stack.asc[]
38-
39-

0 commit comments

Comments
 (0)
Please sign in to comment.