You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: book/chapters/algorithms-analysis.adoc
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ TIP: Algorithms are instructions on how to perform a task.
47
47
Not all algorithms are created equal. There are “good” and “bad” algorithms. The good ones are fast; the bad ones are slow. Slow algorithms cost more money to run. Inefficient algorithms could make some calculations impossible in our lifespan!
48
48
49
49
To give you a clearer picture of how different algorithms perform as the input size grows, take a look at the following problems and how their relative execution time changes as the input size increases.
50
-
(((Tables, Algorithms input size vs Time)))
50
+
(((Tables, Intro, Algorithms input size vs Time)))
51
51
52
52
.Relationship between algorithm input size and time taken to complete
53
53
[cols=",,,,,",options="header",]
@@ -111,7 +111,7 @@ When we are comparing algorithms, we don't want to have complex expressions. Wha
111
111
TIP: Asymptotic analysis describes the behavior of functions as their inputs approach to infinity.
112
112
113
113
In the previous example, we analyzed `getMin` with an array of size 3; what happen size is 10 or 10k or a million?
114
-
(((Tables, Operations of 3n+3)))
114
+
(((Tables, Intro, Operations of 3n+3)))
115
115
116
116
.Operations performed by an algorithm with a time complexity of `3n + 3`
117
117
[cols=",,",options="header",]
@@ -152,8 +152,9 @@ WARNING: Don't drop terms that multiplying other terms. _O(n log n)_ is not equi
152
152
There are many common notations like polynomial, _O(n^2^)_ like we saw in the `getMin` example; constant _O(1)_ and many more that we are going to explore in the next chapter.
153
153
154
154
Again, time complexity is not a direct measure of how long a program takes to execute but rather how many operations it performs in given the input size. Nevertheless, there’s a relationship between time complexity and clock time as we can see in the following table.
155
+
(((Tables, Intro, Input size vs clock time by Big O)))
155
156
156
-
(((Tables, Input size vs clock time by Big O)))
157
+
// tag::table[]
157
158
.How long an algorithm takes to run based on their time complexity and input size
Copy file name to clipboardExpand all lines: book/chapters/big-o-examples.adoc
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -245,7 +245,7 @@ Factorial start very slow and then it quickly becomes uncontrollable. A word siz
245
245
== Summary
246
246
247
247
We went through 8 of the most common time complexities and provided examples for each of them. Hopefully, this will give you a toolbox to analyze algorithms.
248
-
(((Tables, Common time complexities and examples)))
248
+
(((Tables, Intro, Common time complexities and examples)))
249
249
250
250
// tag::table[]
251
251
.Most common algorithmic running times and their examples
Copy file name to clipboardExpand all lines: book/chapters/chapter3.adoc
+19Lines changed: 19 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,5 +60,24 @@ include::graph-search.adoc[]
60
60
= Summary
61
61
62
62
In this section, we learned about Graphs applications, properties and how we can create them. We mention that you can represent a graph as a matrix or as a list of adjacencies. We went for implementing the later since it's more space efficient. We cover the basic graph operations like adding and removing nodes and edges. In the algorithms section, we are going to cover searching values in the graph.
0 commit comments