Skip to content

Commit e04518e

Browse files
authored
Merge branch 'master' into gaussianEliminationInCpp
2 parents 8ae70e6 + 4e3ac16 commit e04518e

File tree

70 files changed

+1820
-580
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1820
-580
lines changed

CONTRIBUTORS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ This file lists everyone, who contributed to this repo and wanted to show up her
3737
- Ken Power
3838
- PaddyKe
3939
- nic-hartley
40+
- Thijs Raymakers
4041
- crafter312
4142
- Christopher Milan
42-
- Vexatos
43+
- Vexatos
44+
- Björn Heinrichs

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
> **IMPORTANT NOTE FOR NEW CONTRIBUTORS:**
22
>
3-
> We do **not** yet accept entirely new chapters by everyone. If you would like to start work on one, get in contact with Leios first. If you create a full chapter, including text, and submit it as a pull request it is most likely going to get rejected.
3+
> We do **not** yet accept entirely new chapters by everyone. If you would like to start working on one, please contact James Schloss (Leios) first. If you create a full chapter, including text, and submit it as a pull request it is most likely going to get rejected.
44
>
55
> If you want to help, it is best to write language examples for *existing* chapters. You can also try to find spelling or other mistakes in existing chapters and submit fixes for those.
66
@@ -32,7 +32,9 @@ Thanks for reading and let me know if there's anything wrong or if you want to s
3232
----
3333

3434
## License
35-
The content of this project itself is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License (link below). The code examples are licensed under the MIT license (found in LICENSE.md).
35+
The code examples for this project are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)).
36+
All text content is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode) with attribution specified at the end of every chapter.
37+
All graphics are licensed under the license stated at the end of every chapter.
38+
If no attribution is specified, please attribute James Schloss.
3639

37-
{% creativecommons type="by-nc" %}
38-
{% endcreativecommons %}
40+
[<p><img class="center" src="contents/cc/CC-BY-SA_icon.svg" /></p>](https://creativecommons.org/licenses/by-sa/4.0/)

SUMMARY.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
* [Mathematical Background](contents/mathematical_background/mathematical_background.md)
99
* [Complexity Notation](contents/notation/notation.md)
1010
* [Bit Logic](contents/bitlogic/bitlogic.md)
11-
* [Convolutions](contents/convolutions/convolutions.md)
1211
* [Taylor Series](contents/taylor_series_expansion/taylor_series_expansion.md)
1312
* [Sorting and Searching](contents/sorting_and_searching/sorting_and_searching.md)
1413
* [Bubble Sort](contents/bubble_sort/bubble_sort.md)

book.json

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
"fontsettings",
55
"mathjax@https://github.com/algorithm-archivists/plugin-mathjax",
66
"bibtex-cite",
7-
"creativecommons",
87
"wordcount",
98
"api-language-selector@https://github.com/algorithm-archivists/gitbook-plugin-api-language-selector.git",
109
"include-codeblock",
1110
"ga",
12-
"bulk-redirect"
11+
"bulk-redirect",
12+
"prism",
13+
"-highlight"
1314
],
1415
"lunr": {
1516
"maxIndexSize": 1000000000
@@ -29,6 +30,18 @@
2930
"ga": {
3031
"token": "UA-118252470-1"
3132
},
33+
"prism": {
34+
"lang": {
35+
"asm-x64": "nasm"
36+
},
37+
"ignore": [
38+
"emojicode",
39+
"text"
40+
],
41+
"css": [
42+
"prismjs/themes/prism-tomorrow.css"
43+
]
44+
},
3245
"api-language-selector": {
3346
"languages": [
3447
{
@@ -52,6 +65,10 @@
5265
"lang": "c",
5366
"name": "C"
5467
},
68+
{
69+
"lang": "c8",
70+
"name": "chip-8"
71+
},
5572
{
5673
"lang": "py",
5774
"name": "Python"
@@ -167,6 +184,10 @@
167184
{
168185
"lang": "lolcode",
169186
"name": "LOLCODE"
187+
},
188+
{
189+
"lang": "piet",
190+
"name": "Piet"
170191
}
171192
]
172193
}

contents/backward_euler_method/backward_euler_method.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,20 @@ MORE TO COME!!!
88
<script>
99
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
1010
</script>
11+
12+
## License
13+
14+
##### Code Examples
15+
16+
The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)).
17+
18+
##### Text
19+
20+
The text of this chapter was written by [James Schloss](https://github.com/leios) and is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode).
21+
22+
[<p><img class="center" src="../cc/CC-BY-SA_icon.svg" /></p>](https://creativecommons.org/licenses/by-sa/4.0/)
23+
24+
##### Pull Requests
25+
26+
After initial licensing ([#560](https://github.com/algorithm-archivists/algorithm-archive/pull/560)), the following pull requests have modified the text or graphics of this chapter:
27+
- none

contents/barnes_hut_algorithm/barnes_hut_algorithm.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,20 @@ TODO
1111
<script>
1212
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
1313
</script>
14+
15+
## License
16+
17+
##### Code Examples
18+
19+
The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)).
20+
21+
##### Text
22+
23+
The text of this chapter was written by [James Schloss](https://github.com/leios) and is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode).
24+
25+
[<p><img class="center" src="../cc/CC-BY-SA_icon.svg" /></p>](https://creativecommons.org/licenses/by-sa/4.0/)
26+
27+
##### Pull Requests
28+
29+
After initial licensing ([#560](https://github.com/algorithm-archivists/algorithm-archive/pull/560)), the following pull requests have modified the text or graphics of this chapter:
30+
- none

contents/bitlogic/bitlogic.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,38 @@ 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>
146+
147+
## License
148+
149+
##### Code Examples
150+
151+
The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)).
152+
153+
##### Text
154+
155+
The text of this chapter was written by [James Schloss](https://github.com/leios) and is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode).
156+
157+
[<p><img class="center" src="../cc/CC-BY-SA_icon.svg" /></p>](https://creativecommons.org/licenses/by-sa/4.0/)
158+
159+
##### Images/Graphics
160+
- The image "[ANDgate](res/and.jpg)" was created by [James Schloss](https://github.com/leios) and is licenced under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode).
161+
- The image "[ORgate](res/or.jpg)" was created by [James Schloss](https://github.com/leios) and is licenced under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode).
162+
- The image "[XORgate](res/xor.jpg)" was created by [James Schloss](https://github.com/leios) and is licenced under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode).
163+
- The image "[NOTgate](res/not.jpg)" was created by [James Schloss](https://github.com/leios) and is licenced under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode).
164+
- The image "[NANDgate](res/nand.jpg)" was created by [James Schloss](https://github.com/leios) and is licenced under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode).
165+
- The image "[NORgate](res/nor.jpg)" was created by [James Schloss](https://github.com/leios) and is licenced under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode).
166+
167+
##### Pull Requests
168+
169+
After initial licensing ([#560](https://github.com/algorithm-archivists/algorithm-archive/pull/560)), the following pull requests have modified the text or graphics of this chapter:
170+
- none

contents/bogo_sort/bogo_sort.md

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ In code, it looks something like this:
2020
{% sample lang="clj" %}
2121
[import:7-11, lang:"clojure"](code/clojure/bogo.clj)
2222
{% sample lang="c" %}
23-
[import:25-29, lang:"c_cpp"](code/c/bogo_sort.c)
23+
[import:25-29, lang:"c"](code/c/bogo_sort.c)
2424
{% sample lang="java" %}
2525
[import:2-6, lang:"java"](code/java/bogo.java)
2626
{% sample lang="js" %}
@@ -34,7 +34,7 @@ In code, it looks something like this:
3434
{% sample lang="lua" %}
3535
[import:1-22, lang="lua"](code/lua/bogosort.lua)
3636
{% sample lang="cpp" %}
37-
[import:33-38, lang:"c_cpp"](code/c++/bogosort.cpp)
37+
[import:33-38, lang:"cpp"](code/c++/bogosort.cpp)
3838
{% sample lang="rs" %}
3939
[import:16-20, lang:"rust"](code/rust/bogosort.rs)
4040
{% sample lang="swift" %}
@@ -54,7 +54,7 @@ In code, it looks something like this:
5454
{% sample lang="racket" %}
5555
[import:3-8, lang:"lisp"](code/racket/bogo_sort.rkt)
5656
{% sample lang="st" %}
57-
[import:2-6, lang:"st"](code/smalltalk/bogosort.st)
57+
[import:2-6, lang:"smalltalk"](code/smalltalk/bogosort.st)
5858
{% sample lang="bash" %}
5959
[import:38-45, lang:"bash"](code/bash/bogo_sort.bash)
6060
{% sample lang="asm-x64" %}
@@ -65,6 +65,10 @@ In code, it looks something like this:
6565
[import:10-14, lang:"crystal"](code/crystal/bogo.cr)
6666
{% sample lang="r" %}
6767
[import:1-6, lang:"r"](code/r/bogo_sort.r)
68+
{% sample lang="scala" %}
69+
[import:12-16, lang:"scala"](code/scala/bogo.scala)
70+
{% sample lang="go" %}
71+
[import:27-31, lang:"go"](code/go/bogo_sort.go)
6872
{% endmethod %}
6973

7074
That's it.
@@ -84,7 +88,7 @@ We are done here!
8488
{% sample lang="clj" %}
8589
[import, lang:"clojure"](code/clojure/bogo.clj)
8690
{% sample lang="c" %}
87-
[import, lang:"c_cpp"](code/c/bogo_sort.c)
91+
[import, lang:"c"](code/c/bogo_sort.c)
8892
{% sample lang="java" %}
8993
[import, lang:"java"](code/java/bogo.java)
9094
{% sample lang="js" %}
@@ -98,7 +102,7 @@ We are done here!
98102
{% sample lang="lua" %}
99103
[import, lang="lua"](code/lua/bogosort.lua)
100104
{% sample lang="cpp" %}
101-
[import, lang:"c_cpp"](code/c++/bogosort.cpp)
105+
[import, lang:"cpp"](code/c++/bogosort.cpp)
102106
{% sample lang="rs" %}
103107
[import, lang:"rust"](code/rust/bogosort.rs)
104108
{% sample lang="swift" %}
@@ -118,7 +122,7 @@ We are done here!
118122
{% sample lang="racket" %}
119123
[import, lang:"lisp"](code/racket/bogo_sort.rkt)
120124
{% sample lang="st" %}
121-
[import, lang:"st"](code/smalltalk/bogosort.st)
125+
[import, lang:"smalltalk"](code/smalltalk/bogosort.st)
122126
{% sample lang="bash" %}
123127
[import, lang:"bash"](code/bash/bogo_sort.bash)
124128
{% sample lang="asm-x64" %}
@@ -129,9 +133,30 @@ We are done here!
129133
[import, lang:"crystal"](code/crystal/bogo.cr)
130134
{% sample lang="r" %}
131135
[import, lang:"r"](code/r/bogo_sort.r)
136+
{% sample lang="scala" %}
137+
[import, lang:"scala"](code/scala/bogo.scala)
138+
{% sample lang="go" %}
139+
[import, lang:"go"](code/go/bogo_sort.go)
132140
{% endmethod %}
133141

134142

135143
<script>
136144
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
137145
</script>
146+
147+
## License
148+
149+
##### Code Examples
150+
151+
The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)).
152+
153+
##### Text
154+
155+
The text of this chapter was written by [James Schloss](https://github.com/leios) and is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode).
156+
157+
[<p><img class="center" src="../cc/CC-BY-SA_icon.svg" /></p>](https://creativecommons.org/licenses/by-sa/4.0/)
158+
159+
##### Pull Requests
160+
161+
After initial licensing ([#560](https://github.com/algorithm-archivists/algorithm-archive/pull/560)), the following pull requests have modified the text or graphics of this chapter:
162+
- none
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import scala.util.Random.shuffle
2+
3+
object BogoSort {
4+
5+
def isSorted(list: List[Int]): Boolean =
6+
list match {
7+
case Nil => true
8+
case a :: b :: _ if a > b => false
9+
case _ :: tail => isSorted(tail)
10+
}
11+
12+
def bogoSort(list: List[Int]): List[Int] =
13+
isSorted(list) match {
14+
case false => bogoSort(shuffle(list))
15+
case _ => list
16+
}
17+
18+
def main(args: Array[String]): Unit = {
19+
val unsorted = List(5, 2, 7, 1, -5)
20+
21+
println("Unsorted list is " + unsorted)
22+
println(" Sorted list is " + bogoSort(unsorted))
23+
}
24+
25+
}

contents/bubble_sort/bubble_sort.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ This means that we need to go through the vector $$\mathcal{O}(n^2)$$ times with
1313
{% sample lang="cs" %}
1414
[import:9-27, lang:"csharp"](code/csharp/BubbleSort.cs)
1515
{% sample lang="c" %}
16-
[import:10-20, lang:"c_cpp"](code/c/bubble_sort.c)
16+
[import:10-20, lang:"c"](code/c/bubble_sort.c)
17+
{% sample lang="c8" %}
18+
[import:39-63, lang:"chip-8"](code/chip8/bubblesort.c8)
1719
{% sample lang="java" %}
1820
[import:2-12, lang:"java"](code/java/bubble.java)
1921
{% sample lang="kotlin" %}
@@ -29,7 +31,7 @@ This means that we need to go through the vector $$\mathcal{O}(n^2)$$ times with
2931
{% sample lang="hs" %}
3032
[import, lang:"haskell"](code/haskell/bubbleSort.hs)
3133
{% sample lang="cpp" %}
32-
[import:13-23, lang:"c_cpp"](code/c++/bubblesort.cpp)
34+
[import:13-23, lang:"cpp"](code/c++/bubblesort.cpp)
3335
{% sample lang="rs" %}
3436
[import:6-16, lang:"rust"](code/rust/bubble_sort.rs)
3537
{% sample lang="d" %}
@@ -84,7 +86,9 @@ Trust me, there are plenty of more complicated algorithms that do precisely the
8486
##### Program.cs
8587
[import, lang:"csharp"](code/csharp/Program.cs)
8688
{% sample lang="c" %}
87-
[import, lang:"c_cpp"](code/c/bubble_sort.c)
89+
[import, lang:"c"](code/c/bubble_sort.c)
90+
{% sample lang="c8" %}
91+
[import, lang:"chip-8"](code/chip8/bubblesort.c8)
8892
{% sample lang="java" %}
8993
[import, lang:"java"](code/java/bubble.java)
9094
{% sample lang="kotlin" %}
@@ -100,7 +104,7 @@ Trust me, there are plenty of more complicated algorithms that do precisely the
100104
{% sample lang="hs" %}
101105
[import, lang:"haskell"](code/haskell/bubbleSort.hs)
102106
{% sample lang="cpp" %}
103-
[import, lang:"c_cpp"](code/c++/bubblesort.cpp)
107+
[import, lang:"cpp"](code/c++/bubblesort.cpp)
104108
{% sample lang="rs" %}
105109
[import, lang:"rust"](code/rust/bubble_sort.rs)
106110
{% sample lang="d" %}
@@ -142,3 +146,20 @@ Trust me, there are plenty of more complicated algorithms that do precisely the
142146
<script>
143147
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
144148
</script>
149+
150+
## License
151+
152+
##### Code Examples
153+
154+
The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)).
155+
156+
##### Text
157+
158+
The text of this chapter was written by [James Schloss](https://github.com/leios) and is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode).
159+
160+
[<p><img class="center" src="../cc/CC-BY-SA_icon.svg" /></p>](https://creativecommons.org/licenses/by-sa/4.0/)
161+
162+
##### Pull Requests
163+
164+
After initial licensing ([#560](https://github.com/algorithm-archivists/algorithm-archive/pull/560)), the following pull requests have modified the text or graphics of this chapter:
165+
- none

0 commit comments

Comments
 (0)