Skip to content

Commit fb4f592

Browse files
authored
Adding videos to chapters (algorithm-archivists#554)
* adding videos to chapters. * fixing typo from youtube comment. * Update contents/euclidean_algorithm/euclidean_algorithm.md Co-Authored-By: leios <[email protected]> * Apply suggestions from code review Co-Authored-By: leios <[email protected]>
1 parent d740d52 commit fb4f592

File tree

10 files changed

+80
-3
lines changed

10 files changed

+80
-3
lines changed

contents/bitlogic/bitlogic.md

+7
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,13 @@ There are a few other gates, but this is enough for most things. We'll add more
133133

134134
That's about it for bitlogic. I realize it was a bit long, but this is absolutely essential to understanding how computers think and how to use programming as an effective tool!
135135

136+
## Video Explanation
137+
Here is a video describing the contents of this chapter:
138+
139+
<div style="text-align:center">
140+
<iframe width="560" height="315" src="https://www.youtube.com/embed/zMuEk44Ufkw" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
141+
</div>
142+
136143
<script>
137144
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
138145
</script>

contents/euclidean_algorithm/euclidean_algorithm.md

+8
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,14 @@ Here, we set `b` to be the remainder of `a%b` and `a` to be whatever `b` was las
142142

143143
The Euclidean Algorithm is truly fundamental to many other algorithms throughout the history of computer science and will definitely be used again later. At least to me, it's amazing how such an ancient algorithm can still have modern use and appeal. That said, there are still other algorithms out there that can find the greatest common divisor of two numbers that are arguably better in certain cases than the Euclidean algorithm, but the fact that we are discussing Euclid two millennia after his death shows how timeless and universal mathematics truly is. I think that's pretty cool.
144144

145+
## Video Explanation
146+
147+
Here's a video on the Euclidean algorithm:
148+
149+
<div style="text-align:center">
150+
<iframe width="560" height="315" src="https://www.youtube.com/embed/h86RzlyHfUE" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
151+
</div>
152+
145153
## Example Code
146154

147155
{% method %}

contents/forward_euler_method/forward_euler_method.md

+8
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ Verlet integration has a distinct advantage over the forward Euler method in bot
9191
That said, in practice, due to the instability of the forward Euler method and the error with larger timesteps, this method is rarely used in practice.
9292
That said, variations of this method *are* certainly used (for example Crank-Nicolson and [Runge-Kutta](../runge_kutta_methods/runge_kutta_methods.md), so the time spent reading this chapter is not a total waste!
9393

94+
## Video Explanation
95+
96+
Here is a video describing the forward Euler method:
97+
98+
<div style="text-align:center">
99+
<iframe width="560" height="315" src="https://www.youtube.com/embed/wG7h8g6VLBo" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
100+
</div>
101+
94102
## Example Code
95103

96104
Like in the case of [Verlet Integration](../verlet_integration/verlet_integration.md), the easiest way to test to see if this method works is to test it against a simple test-case.

contents/gaussian_elimination/gaussian_elimination.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ $$
8282
This matrix form has a particular name: _Row Echelon Form_.
8383
Basically, any matrix can be considered in row echelon form if the leading coefficient or _pivot_ (the first non-zero element in every row when reading from left to right) is right of the pivot of the row above it.
8484

85-
This creates a matrix that sometiems resembles an upper-triangular matrix; however, that doesn't mean that all row-echelon matrices are upper-triangular.
85+
This creates a matrix that sometimes resembles an upper-triangular matrix; however, that doesn't mean that all row-echelon matrices are upper-triangular.
8686
For example, all of the following matrices are in row echelon form:
8787

8888
$$
@@ -529,6 +529,14 @@ How? Well, we can use an algorithm known as the _Tri-Diagonal Matrix Algorithm_
529529

530530
There are also plenty of other solvers that do similar things that we will get to in due time.
531531

532+
## Video Explanation
533+
534+
Here's a video describing Gaussian elimination:
535+
536+
<div style="text-align:center">
537+
<iframe width="560" height="315" src="https://www.youtube.com/embed/2tlwSqblrvU" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
538+
</div>
539+
532540
## Example Code
533541

534542
{% method %}

contents/huffman_encoding/huffman_encoding.md

+8
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ and `bibbity_bobbity` becomes `01000010010111011110111000100101110`.
4747
As mentioned this uses the minimum number of bits possible for encoding.
4848
The fact that this algorithm is both conceptually simple and provably useful is rather extraordinary to me and is why Huffman encoding will always hold a special place in my heart.
4949

50+
## Video Explanation
51+
52+
Here is a quick video explanation for Huffman encoding:
53+
54+
<div style="text-align:center">
55+
<iframe width="560" height="315" src="https://www.youtube.com/embed/wHyUxTc2Ohk" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
56+
</div>
57+
5058
## Example Code
5159
In code, this can be a little tricky. It requires a method to continually sort the nodes as you add more and more nodes to the system.
5260
The most straightforward way to do this in some languages is with a priority queue, but depending on the language, this might be more or less appropriate.

contents/monte_carlo_integration/monte_carlo_integration.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ As long as you can write some function to tell whether the provided point is ins
108108
This is obviously an incredibly powerful tool and has been used time and time again for many different areas of physics and engineering.
109109
I can guarantee that we will see similar methods crop up all over the place in the future!
110110

111+
## Video Explanation
112+
113+
Here is a video describing Monte Carlo integration:
114+
115+
<div style="text-align:center">
116+
<iframe width="560" height="315" src="https://www.youtube.com/embed/AyBNnkYrSWY" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
117+
</div>
118+
111119
## Example Code
112120
Monte Carlo methods are famous for their simplicity.
113121
It doesn't take too many lines to get something simple going.
@@ -179,8 +187,6 @@ Feel free to submit your version via pull request, and thanks for reading!
179187
[import, lang:"bash"](code/bash/monte_carlo.bash)
180188
{% endmethod %}
181189

182-
183-
184190
<script>
185191
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
186192
</script>

contents/split-operator_method/split-operator_method.md

+8
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,14 @@ As you can see from the code, this involves summing the density, multiplying tha
161161

162162
The Split-Operator method is one of the most commonly used quantum simulation algorithms because of how straightforward it is to code and how quickly you can start really digging into the physics of the simulation results!
163163

164+
## Video Explanation
165+
166+
Here is a video describing the split-operator method:
167+
168+
<div style="text-align:center">
169+
<iframe width="560" height="315" src="https://www.youtube.com/embed/BBt8EugN03Q" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
170+
</div>
171+
164172
## Example Code
165173
This example code is a simulation of a gaussian distribution of atoms slightly offset in a harmonic trap in imaginary time.
166174
So long as the code is written appropriately, this means that the atoms should move towards the center of the trap and the energy should decay to $$\frac{1}{2}\hbar\omega$$, which will be simply $$\frac{1}{2}$$ in this simulation.

contents/stable_marriage_problem/stable_marriage_problem.md

+8
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ To be clear, even though this algorithm seems conceptually simple, it is rather
1818
I do not at all claim that the code provided here is efficient and we will definitely be coming back to this problem in the future when we have more tools under our belt.
1919
I am incredibly interested to see what you guys do and how you implement the algorithm.
2020

21+
## Video Explanation
22+
23+
Here is a video describing the stable marriage problem:
24+
25+
<div style="text-align:center">
26+
<iframe width="560" height="315" src="https://www.youtube.com/embed/A7xRZQAQU8s" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
27+
</div>
28+
2129
## Example Code
2230

2331
{% method %}

contents/tree_traversal/tree_traversal.md

+8
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,14 @@ And this is exactly what Breadth-First Search (BFS) does! On top of that, it can
269269
[import:81-96, lang:"emojicode"](code/emojicode/tree_traversal.emojic)
270270
{% endmethod %}
271271

272+
## Video Explanation
273+
274+
Here is a video describing tree traversal:
275+
276+
<div style="text-align:center">
277+
<iframe width="560" height="315" src="https://www.youtube.com/embed/cZPXfl_tUkA" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
278+
</div>
279+
272280
## Example Code
273281
{% method %}
274282
{% sample lang="jl" %}

contents/verlet_integration/verlet_integration.md

+8
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,14 @@ Unfortunately, this has not yet been implemented in LabVIEW, so here's Julia cod
193193

194194
Even though this method is more widely 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))$$.
195195

196+
## Video Explanation
197+
198+
Here is a video describing Verlet integration:
199+
200+
<div style="text-align:center">
201+
<iframe width="560" height="315" src="https://www.youtube.com/embed/g55QvpAev0I" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
202+
</div>
203+
196204
## Example Code
197205

198206
Both of these methods work simply by iterating timestep-by-timestep and can be written straightforwardly in any language. For reference, here are snippets of code that use both the classic and velocity Verlet methods to find the time it takes for a ball to hit the ground after being dropped from a given height.

0 commit comments

Comments
 (0)