Skip to content

Commit c052e21

Browse files
leiosjune128
authored andcommitted
removing principles of code chapter, updating book (#250)
* removing principles of code chapter. * modifying content again and removing mathematical background section. * adding redirects to this structure. * changed title sizes, removed unused files from SUMMARY, and removed taylor_series directory * fixing redirect for taylor series
1 parent 8b0e8f1 commit c052e21

File tree

37 files changed

+58
-521
lines changed

37 files changed

+58
-521
lines changed

SUMMARY.md

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,21 @@
11
# Summary
22

33
* [Algorithm Archive](README.md)
4-
* [TODO](TODO.md)
54
* [Introduction](chapters/introduction/introduction.md)
6-
* [A Personal Note](chapters/introduction/my_introduction_to_hobby_programming.md)
75
* [How To Contribute](chapters/introduction/how_to_contribute.md)
8-
* [Principles of Code](chapters/principles_of_code/principles_of_code.md)
9-
* [Choosing A Language](chapters/principles_of_code/choosing_a_language/choosing_a_language.md)
10-
* [Compiled Languages](chapters/principles_of_code/choosing_a_language/compiled/compiled.md)
11-
* [Makefiles](chapters/principles_of_code/choosing_a_language/compiled/makefiles.md)
12-
* [FORTRAN](chapters/principles_of_code/choosing_a_language/compiled/FORTRAN.md)
13-
* [Building Blocks](chapters/principles_of_code/building_blocks/building_blocks.md)
14-
* [Variables and Types](chapters/principles_of_code/building_blocks/variables.md)
15-
* [Conditions](chapters/principles_of_code/building_blocks/conditions.md)
16-
* [Loops](chapters/principles_of_code/building_blocks/loops.md)
17-
* [Functions](chapters/principles_of_code/building_blocks/functions.md)
18-
* [Classes](chapters/principles_of_code/building_blocks/classes.md)
19-
* [Stacks and Queues](chapters/principles_of_code/building_blocks/stacks.md)
20-
* [Bit Logic](chapters/principles_of_code/building_blocks/bitlogic.md)
21-
* [Version Control](chapters/principles_of_code/version_control.md)
22-
* [Complexity Notation](chapters/principles_of_code/notation/notation.md)
23-
* [Convolutions](chapters/algorithms/convolutions/convolutions.md)
24-
* [Taylor Series](chapters/general/taylor_series_expansion/taylor_series_expansion.md)
6+
* [Version Control](chapters/introduction/version_control.md)
7+
* [Data Structures](chapters/data_structures/data_structures.md)
8+
* [Stacks and Queues](chapters/data_structures/stacks_and_queues/stacks_and_queues.md)
9+
* [Mathematical Background](chapters/general/mathematical_background/mathematical_background.md)
10+
* [Complexity Notation](chapters/general/notation/notation.md)
11+
* [Bit Logic](chapters/general/bitlogic/bitlogic.md)
12+
* [Convolutions](chapters/algorithms/convolutions/convolutions.md)
13+
* [Taylor Series](chapters/general/taylor_series_expansion/taylor_series_expansion.md)
2514
* [Sorting and Searching](chapters/general/sorting_and_searching/sorting_and_searching.md)
2615
* [Bubble Sort](chapters/algorithms/bubble_sort/bubble_sort.md)
2716
* [Bogo Sort](chapters/algorithms/bogo_sort/bogo_sort.md)
2817
* [Tree Traversal](chapters/algorithms/tree_traversal/tree_traversal.md)
2918
* [Euclidean Algorithm](chapters/algorithms/euclidean_algorithm/euclidean_algorithm.md)
30-
* [Multiplication](chapters/general/multiplication/multiplication.md)
3119
* [Monte Carlo](chapters/algorithms/monte_carlo_integration/monte_carlo_integration.md)
3220
* [Matrix Methods](chapters/general/matrix_methods/matrix_methods.md)
3321
* [Gaussian Elimination](chapters/algorithms/gaussian_elimination/gaussian_elimination.md)
@@ -36,16 +24,13 @@
3624
* [Gift Wrapping](chapters/general/gift_wrapping/gift_wrapping.md)
3725
* [Jarvis March](chapters/algorithms/jarvis_march/jarvis_march.md)
3826
* [Graham Scan](chapters/algorithms/graham_scan/graham_scan.md)
39-
* [Chan's Algorithm](chapters/algorithms/chans_algorithm/chans_algorithm.md)
4027
* [FFT](chapters/algorithms/cooley_tukey/cooley_tukey.md)
4128
* [Decision Problems](chapters/general/decision_problems/decision_problems.md)
4229
* [Stable Marriage Problem](chapters/algorithms/stable_marriage_problem/stable_marriage_problem.md)
4330
* [Differential Equation Solvers](chapters/general/differential_equations/differential_equations.md)
4431
* [Forward Euler Method](chapters/algorithms/forward_euler_method/forward_euler_method.md)
45-
* [Backward Euler Methods](chapters/algorithms/backward_euler_method/backward_euler_method.md)
4632
* [Physics Solvers](chapters/general/physics_solvers/physics_solvers.md)
4733
* [Verlet Integration](chapters/algorithms/verlet_integration/verlet_integration.md)
48-
* [Barnes-Hut](chapters/algorithms/barnes_hut_algorithm/barnes_hut_algorithm.md)
4934
* [Quantum Systems](chapters/general/quantum_systems/quantum_systems.md)
5035
* [Split-Operator Method](chapters/algorithms/split-operator_method/split-operator_method.md)
5136
* [Data Compression](chapters/general/data_compression/data_compression.md)

TODO.md

Lines changed: 0 additions & 29 deletions
This file was deleted.

chapters/algorithms/backward_euler_method/backward_euler_method.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
### Backward Euler Method
1+
# Backward Euler Method
22

33
Unlike the forward Euler Method above, the backward Euler Method is an *implicit method*, which means that it results in a system of equations to solve. Luckily, we know how to solve systems of equations (*hint*: [Thomas Algorithm](../thomas_algorithm/thomas_algorithm.md), [Gaussian Elimination](../gaussian_elimination/gaussian_elimination.md))
44

chapters/algorithms/forward_euler_method/forward_euler_method.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# The Forward Euler Method
22

33
The Euler methods are some of the simplest methods to solve ordinary differential equations numerically.
4-
They introduce a new set of methods called the [Runge Kutta](../runge_kutta_methods/runge_kutta_methods.md) methods, which will be discussed in the near future!
4+
They introduce a new set of methods called the Runge Kutta methods, which will be discussed in the near future!
55

66
As a physicist, I tend to understand things through methods that I have learned before.
77
In this case, it makes sense for me to see Euler methods as extensions of the [Taylor Series Expansion](../general/taylor_series_expansion/taylor_series_expansion.md).
@@ -48,7 +48,7 @@ $$
4848
$$
4949

5050
Now, solving this set of equations in this way is known as the *forward* Euler Method.
51-
In fact, there is another method known as the [*backward* Euler Method](../backward_euler_method/backward_euler_method.md), which we will get to soon enough.
51+
In fact, there is another method known as the *backward* Euler Method, which we will get to soon enough.
5252
For now, it is important to note that the error of these methods depend on the timestep chosen.
5353

5454
<p>

chapters/algorithms/verlet_integration/verlet_integration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ Unfortunately, this has not yet been implemented in LabVIEW, so here's Julia cod
162162
{% endmethod %}
163163

164164

165-
Even though this method is more used than the simple Verlet method mentioned above, it unforunately has an error term of $$\mathcal{O} \Delta t^2$$, which is two orders of magnitude worse. That said, if you want to have a simulaton with many objects that depend on one another --- like a gravity simulation --- the Velocity Verlet algorithm is a handy choice; however, you may have to play further tricks to allow everything to scale appropriately. These types of simulatons are sometimes called *n-body* simulations and one such trick is the [Barnes-Hut](../barnes_hut_algorithm/barnes_hut_algorithm.md) algorithm, which cuts the complexity of n-body simulations from $$\sim \mathcal{O}(n^2)$$ to $$\sim \mathcal{O}(n\log(n))$$
165+
Even though this method is more used than the simple Verlet method mentioned above, it unforunately has an error term of $$\mathcal{O} \Delta t^2$$, which is two orders of magnitude worse. That said, if you want to have a simulaton with many objects that depend on one another --- like a gravity simulation --- the Velocity Verlet algorithm is a handy choice; however, you may have to play further tricks to allow everything to scale appropriately. These types of simulatons are sometimes called *n-body* simulations and one such trick is the Barnes-Hut algorithm, which cuts the complexity of n-body simulations from $$\sim \mathcal{O}(n^2)$$ to $$\sim \mathcal{O}(n\log(n))$$
166166

167167
## Example Code
168168

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Data Structures
2+
3+
This is a book about algorithms.
4+
The fundamental building blocks of algorithms are data structures, and thus as more algorithms are added to the Archive, more data structures will be added to this section.

chapters/principles_of_code/building_blocks/bitlogic.md renamed to chapters/general/bitlogic/bitlogic.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
### Bit Logic
1+
# Bit Logic
22

33
We write code in a language that makes a little sense to us, but does not make sense at all to our computer without a compiler to transform the code we write into a language the computer can understand.
44
In the end, whenever we write code, all of the data structures we write are transformed into binary strings of 1's and 0's to be interpreted by our computer.
55
That said, it's not always obvious how this happens, so let's start the simple case of integer numbers.
66

7-
#### Integers
7+
## Integers
88
For integer numbers, 0 is still 0 and 1 is still 1; however, for 2, we need to use 2 digits because binary only has 0's and 1's. When we get to 4, we'll need 3 digits and when we get to 8, we'll need 4. Ever time we cross a power of 2, we'll need to add a new digit. Here's a table of the first 10 integers in binary:
99

1010
| Integer Number | Binary Number |
@@ -45,7 +45,7 @@ Another method is to "roll over" to negative numbers when the bit count gets too
4545

4646
Ultimately, integer numbers are not that difficult to deal with in binary, so let's move onto something more complicated: *floating-point numbers!*
4747

48-
#### Floating-point Numbers
48+
## Floating-point Numbers
4949
Floats are numbers with a decimal point.
5050
9.125 is a float. 9.000 is a float. 9 is an integer.
5151
Here are a few floats and their integer representations:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
### Differential Equations
1+
# Differential Equations
22

33
Differential equations lie at the heart of many different systems in physics, economics, biology, chemistry, and many other areas of research and engineering.
44
Here, we discuss many different methods to solve particular sets of differential equations.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Mathematical Background
2+
3+
No matter who you ask, programming requires at least a little math.
4+
That said, for most programmers, it doesn't require *too* much.
5+
For the most part, depending on your specialty, you will probably not see too much calculus or differential equations.
6+
Honestly, you could probably get away with what you learned in high school.
7+
8+
However, this is a book about algorithms, and algorithms sometimes require a deeper understanding of mathematics.
9+
This section attemps to provide the mathematical foundations that you will need to understand certain algorithms.
10+
As we add new algorithms and need new mathematical tools, we will add them to this section.
11+
12+
A notable exception to this rule will be in the case of classes of algorithms that require domain-specific knowledge, like quantum simulations or bioinformatics.
13+
In those cases, we will place the mathematical methods in more relevant sections.

chapters/principles_of_code/notation/notation.md renamed to chapters/general/notation/notation.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
### Complexity Notation
1+
# Complexity Notation
22

33
Algorithms are designed to solve problems.
44
Over time, new algorithms are created to solve problems that old algorithms have already solved.
@@ -25,7 +25,7 @@ Of the three Big $$O$$ is used the most, and is used in conversation to mean tha
2525
Unfortunately, at this point, these notations might be a little vague.
2626
In fact, it was incredibly vague for me for a long time, and it wasn't until I saw the notations in action that it all started to make sense, so that's what this section is about: providing concrete examples to better understand computational complexity notation.
2727

28-
### Constant Time
28+
## Constant Time
2929

3030
Let's write some code that reads in an array of length `n` and runs with constant time:
3131

@@ -66,7 +66,7 @@ Just because this is common practice does not mean it's the *best* practice.
6666
I have run into several situation where knowing the constants has saved me hours of run-time, so keep in mind that all of these notations are somewhat vague and dependent on a number of auxiliary factors.
6767
Still, that doesn't mean the notation is completely useless. For now, let's keep moving forward with some more complicated (and useful) examples!
6868

69-
### Linear Time
69+
## Linear Time
7070

7171
Now we are moving into interesting territory!
7272
Let's consider the following function:
@@ -127,7 +127,7 @@ That said, there have been several cases throughout the history of algorithms wh
127127
For this reason, if you can avoid writing nested `for` loops, you certainly should!
128128
However, there are several cases where this cannot be avoided, so don't spend too much time worrying about it unless runtime becomes an issue!
129129

130-
### Exponential and Logarithmic Time
130+
## Exponential and Logarithmic Time
131131
These are two more cases that come up all the time and often require a common theme: *recursion*.
132132
Generally speaking, logarithmic algorithms are some of the fastest algorithms out there, while exponential algorithms are some of the slowest.
133133
Unfortunately, this means that recursion can be either the most useful tool in existence for realizing certain algorithms or the most harmful one, depending on your problem.
@@ -165,7 +165,7 @@ If we split these new arrays, we have 4 arrays of 2, and if we split these by tw
165165
This is as far as we can go, and we ended up dividing the array 3 times to get to this point.
166166
$$3 = \log_2(8)$$, so this function runs with a logarithmic number of operations.
167167

168-
### Putting it all together
168+
## Putting it all together
169169

170170
We've outlined the most common complexity cases of different algorithms here, but at this point things might still be unclear.
171171
Which is better: $$O(n^2)$$ or $$O(log(n))$$?

chapters/general/physics_solvers/physics_solvers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
### Physics Solvers
1+
# Physics Solvers
22

33
There are certain algorithms that have been uniquely created to solve particular physical systems.
44
For example, the kinematic equation can be solved with Verlet integration and also with more general differential equation solvers.

chapters/introduction/how_to_contribute.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
## How to Contribute to the Algorithm Archive
1+
# How to Contribute to the Algorithm Archive
22

33
The *Algorithm Archive* is an effort to learn about and teach algorithms as a community.
44
As such, it requires a certain level of trust between community members.
5-
For the most part, the collaboration can be done via GitHub and gitbook, so it is important to understand the basics of [version control](../principles_of_code/version_control.md).
5+
For the most part, the collaboration can be done via GitHub and gitbook, so it is important to understand the basics of [version control](version_control.md).
66
Ideally, all code provided by the community will be submitted via pull requests and discussed accordingly; however, I understand that many individuals are new to collaborative projects, so I will allow submissions by other means (comments, tweets, etc...).
77
As this project grows in size, it will be harder and harder to facilitate these submissions.
88
In addition, by submitting in any way other than pull requests, I cannot guarantee I will be able to list you as a collaborator (though I will certainly do my best to update the `CONTRIBUTORS.md` file accordingly).

chapters/principles_of_code/version_control.md renamed to chapters/introduction/version_control.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Git and Version Control
1+
# Git and Version Control
22

33
I am a fan of open-source software. It allows users to see inside the code running on their system and mess around with it if they like.
44
Unlike proprietary software, open source software allows any user to learn the entire codebase from the ground up, and that's an incredibly exciting prospect!

chapters/principles_of_code/building_blocks/building_blocks.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

chapters/principles_of_code/building_blocks/classes.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)