diff --git a/SUMMARY.md b/SUMMARY.md
index 270509494..161115b01 100644
--- a/SUMMARY.md
+++ b/SUMMARY.md
@@ -12,9 +12,6 @@
* [Complexity Notation](contents/notation/notation.md)
* [Bit Logic](contents/bitlogic/bitlogic.md)
* [Taylor Series](contents/taylor_series_expansion/taylor_series_expansion.md)
-* [Sorting and Searching](contents/sorting_and_searching/sorting_and_searching.md)
- * [Bubble Sort](contents/bubble_sort/bubble_sort.md)
- * [Bogo Sort](contents/bogo_sort/bogo_sort.md)
* [Tree Traversal](contents/tree_traversal/tree_traversal.md)
* [Euclidean Algorithm](contents/euclidean_algorithm/euclidean_algorithm.md)
* [Monte Carlo](contents/monte_carlo_integration/monte_carlo_integration.md)
diff --git a/contents/bogo_sort/bogo_sort.md b/contents/bogo_sort/bogo_sort.md
deleted file mode 100644
index 5f493e0e1..000000000
--- a/contents/bogo_sort/bogo_sort.md
+++ /dev/null
@@ -1,166 +0,0 @@
-# Bogo Sort
-Look, Bogo Sort doesn't really sort anything out.
-In fact, it should never be used in practice for any reason I can think of and really only serves as a joke in the programming community.
-As far as jokes go, though, this one's pretty good.
-
-So, here's how it goes:
-imagine you have an array of $$n$$ elements that you want sorted.
-One way to do it is to shuffle the array at random and hope that all the elements will be magically in order after shuffling.
-If they are not in order, just shuffle everything again.
-And then again. And again.
-In the best case, this algorithm runs with a complexity of $$\Omega(n)$$, and in the worst, $$\mathcal{O}(\infty)$$.
-
-In code, it looks something like this:
-
-{% method %}
-{% sample lang="jl" %}
-[import:12-16, lang:"julia"](code/julia/bogo.jl)
-{% sample lang="cs" %}
-[import:9-15, lang:"csharp"](code/csharp/BogoSort.cs)
-{% sample lang="clj" %}
-[import:7-11, lang:"clojure"](code/clojure/bogo.clj)
-{% sample lang="c" %}
-[import:25-29, lang:"c"](code/c/bogo_sort.c)
-{% sample lang="java" %}
-[import:2-6, lang:"java"](code/java/Bogo.java)
-{% sample lang="js" %}
-[import:11-15, lang:"javascript"](code/javascript/bogo.js)
-{% sample lang="py" %}
-[import:10-12, lang:"python"](code/python/bogo.py)
-{% sample lang="hs" %}
-[import:17-20, lang:"haskell"](code/haskell/bogoSort.hs)
-{% sample lang="m" %}
-[import:21-28, lang:"matlab"](code/matlab/bogosort.m)
-{% sample lang="lua" %}
-[import:17-22, lang="lua"](code/lua/bogosort.lua)
-{% sample lang="cpp" %}
-[import:33-38, lang:"cpp"](code/c++/bogosort.cpp)
-{% sample lang="rs" %}
-[import:16-20, lang:"rust"](code/rust/bogosort.rs)
-{% sample lang="swift" %}
-[import:13-19, lang:"swift"](code/swift/bogosort.swift)
-{% sample lang="php" %}
-[import:15-22, lang:"php"](code/php/bogo_sort.php)
-{% sample lang="nim" %}
-[import:16-18, lang:"nim"](code/nim/bogo_sort.nim)
-{% sample lang="ruby" %}
-[import:12-16, lang:"ruby"](code/ruby/bogo.rb)
-{% sample lang="emojic" %}
-[import:2-6, lang:"emojicode"](code/emojicode/bogo_sort.emojic)
-{% sample lang="factor" %}
-[import:10-12, lang:"factor"](code/factor/bogo_sort.factor)
-{% sample lang="f90" %}
-[import:24-32, lang:"fortran"](code/fortran/bogo.f90)
-{% sample lang="racket" %}
-[import:3-8, lang:"lisp"](code/racket/bogo_sort.rkt)
-{% sample lang="st" %}
-[import:2-6, lang:"smalltalk"](code/smalltalk/bogosort.st)
-{% sample lang="bash" %}
-[import:38-45, lang:"bash"](code/bash/bogo_sort.bash)
-{% sample lang="asm-x64" %}
-[import:93-113, lang:"asm-x64"](code/asm-x64/bogo_sort.s)
-{% sample lang="lisp" %}
-[import:20-24, lang:"lisp"](code/clisp/bogo-sort.lisp)
-{% sample lang="crystal" %}
-[import:10-14, lang:"crystal"](code/crystal/bogo.cr)
-{% sample lang="r" %}
-[import:1-6, lang:"r"](code/r/bogo_sort.r)
-{% sample lang="scala" %}
-[import:12-16, lang:"scala"](code/scala/bogo.scala)
-{% sample lang="go" %}
-[import:27-31, lang:"go"](code/go/bogo_sort.go)
-{% sample lang="coco" %}
-[import:6-8, lang:"coconut"](code/coconut/bogo.coco)
-{% endmethod %}
-
-That's it.
-Ship it!
-We are done here!
-
-## Example Code
-
-{% method %}
-{% sample lang="jl" %}
-[import, lang:"julia"](code/julia/bogo.jl)
-{% sample lang="cs" %}
-##### BogoSort.cs
-[import, lang:"csharp"](code/csharp/BogoSort.cs)
-##### Program.cs
-[import, lang:"csharp"](code/csharp/Program.cs)
-{% sample lang="clj" %}
-[import, lang:"clojure"](code/clojure/bogo.clj)
-{% sample lang="c" %}
-[import, lang:"c"](code/c/bogo_sort.c)
-{% sample lang="java" %}
-[import, lang:"java"](code/java/Bogo.java)
-{% sample lang="js" %}
-[import, lang:"javascript"](code/javascript/bogo.js)
-{% sample lang="py" %}
-[import, lang:"python"](code/python/bogo.py)
-{% sample lang="hs" %}
-[import, lang:"haskell"](code/haskell/bogoSort.hs)
-{% sample lang="m" %}
-[import, lang:"matlab"](code/matlab/bogosort.m)
-{% sample lang="lua" %}
-[import, lang="lua"](code/lua/bogosort.lua)
-{% sample lang="cpp" %}
-[import, lang:"cpp"](code/c++/bogosort.cpp)
-{% sample lang="rs" %}
-[import, lang:"rust"](code/rust/bogosort.rs)
-{% sample lang="swift" %}
-[import, lang:"swift"](code/swift/bogosort.swift)
-{% sample lang="php" %}
-[import, lang:"php"](code/php/bogo_sort.php)
-{% sample lang="nim" %}
-[import, lang:"nim"](code/nim/bogo_sort.nim)
-{% sample lang="ruby" %}
-[import, lang:"ruby"](code/ruby/bogo.rb)
-{% sample lang="emojic" %}
-[import, lang:"emojicode"](code/emojicode/bogo_sort.emojic)
-{% sample lang="factor" %}
-[import, lang:"factor"](code/factor/bogo_sort.factor)
-{% sample lang="f90" %}
-[import, lang:"fortran"](code/fortran/bogo.f90)
-{% sample lang="racket" %}
-[import, lang:"lisp"](code/racket/bogo_sort.rkt)
-{% sample lang="st" %}
-[import, lang:"smalltalk"](code/smalltalk/bogosort.st)
-{% sample lang="bash" %}
-[import, lang:"bash"](code/bash/bogo_sort.bash)
-{% sample lang="asm-x64" %}
-[import, lang:"asm-x64"](code/asm-x64/bogo_sort.s)
-{% sample lang="lisp" %}
-[import, lang:"lisp"](code/clisp/bogo-sort.lisp)
-{% sample lang="crystal" %}
-[import, lang:"crystal"](code/crystal/bogo.cr)
-{% sample lang="r" %}
-[import, lang:"r"](code/r/bogo_sort.r)
-{% sample lang="scala" %}
-[import, lang:"scala"](code/scala/bogo.scala)
-{% sample lang="go" %}
-[import, lang:"go"](code/go/bogo_sort.go)
-{% sample lang="coco" %}
-[import, lang:"coconut"](code/coconut/bogo.coco)
-{% endmethod %}
-
-
-
-
-## License
-
-##### Code Examples
-
-The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)).
-
-##### Text
-
-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).
-
-[
](https://creativecommons.org/licenses/by-sa/4.0/)
-
-##### Pull Requests
-
-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:
-- none
diff --git a/contents/bogo_sort/code/asm-x64/bogo_sort.s b/contents/bogo_sort/code/asm-x64/bogo_sort.s
deleted file mode 100644
index 3980f821b..000000000
--- a/contents/bogo_sort/code/asm-x64/bogo_sort.s
+++ /dev/null
@@ -1,147 +0,0 @@
-.intel_syntax noprefix
-
-.section .rodata
- array:
- .align 16
- .int 1, 3654, 78, 654, -234, -12, 4, 3, -6, -100
- .equ array_len, (.-array) / 4
- array_fmt: .string "%d "
- lf: .string "\n"
- unsorted: .string "Unsorted array: "
- sorted: .string "Sorted array: "
-
-.section .text
- .global main
- .extern printf, rand, srand
-
-# rdi - array ptr
-# rsi - array size
-print_array:
- push r12
- push r13
- mov r12, rdi # Loop variable
- lea r13, [rdi + 4 * rsi] # Pointer after the last element
-print_array_loop:
- cmp r12, r13 # If we're done iterating over the array then bail
- jge print_array_done
- mov rdi, OFFSET array_fmt # Otherwise print the current value
- mov esi, DWORD PTR [r12]
- xor rax, rax
- call printf
- lea r12, [r12 + 4] # And increment the loop variable pointer
- jmp print_array_loop
-print_array_done:
- mov rdi, OFFSET lf # Print a closing newline
- xor rax, rax
- call printf
- pop r13
- pop r12
- ret
-
-# rdi - array ptr
-# rsi - array size
-# RET rax - boolean
-is_sorted:
- sub rsi, 1 # Getting array + n and *array + n - 1
- lea rcx, [rsi - 1]
- lea rcx, [rdi + 4 * rcx]
- lea rsi, [rdi + 4 * rsi]
-is_sorted_loop:
- cmp rsi, rdi # Check if array + n - 1 == array
- je is_sorted_done
- mov edx, DWORD PTR [rsi] # Load value to register
- xor rax, rax # Set rax to 0
- cmp edx, DWORD PTR [rcx] # Check if array[n] < array[n - 1]
- jl is_sorted_return
- sub rcx, 4 # If not make pointers go to down an element
- sub rsi, 4
- jmp is_sorted_loop
-is_sorted_done:
- mov rax, 1 # If sorted then set rax to 1
-is_sorted_return:
- ret # Return
-
-# rdi - array ptr
-# rsi - array size
-shuffle:
- push r12
- push r13
- push r14
- push r15
- mov r12, rdi # Save parameters
- mov r13, rsi
- xor r14, r14
-shuffle_loop:
- cmp r14, r13 # Check if i == array size
- je shuffle_done
- mov r15d, DWORD PTR [r12 + r14 * 4] # Save array[i]
- call rand # Swap a random element with array[i]
- xor edx, edx
- div r13 # Mod random number to keep in array
- mov eax, DWORD PTR [r12 + rdx * 4]
- mov DWORD PTR [r12 + r14 * 4], eax
- mov DWORD PTR [r12 + rdx * 4], r15d
- add r14, 1 # increment then repeat
- jmp shuffle_loop
-shuffle_done:
- pop r15
- pop r14
- pop r13
- pop r12
- ret
-
-# rdi - array ptr
-# rsi - array size
-bogo_sort:
- push r12
- push r13
- mov r12, rdi
- mov r13, rsi
-bogo_sort_loop:
- mov rdi, r12 # Check if the array is sorted
- mov rsi, r13
- call is_sorted
- test rax, rax
- jnz bogo_sort_done
- mov rdi, r12 # If not then shuffle
- mov rsi, r13
- call shuffle
- jmp bogo_sort_loop
-bogo_sort_done:
- pop r13
- pop r12
- ret
-
-main:
- # Set up our stack
- sub rsp, 40
- # We load the array in chunks onto the stack
- movaps xmm0, XMMWORD PTR [array]
- movaps XMMWORD PTR [rsp], xmm0
- movaps xmm0, XMMWORD PTR [array + 16]
- movaps XMMWORD PTR [rsp + 16], xmm0
- mov rax, QWORD PTR [array + 32]
- mov QWORD PTR [rsp + 32], rax
- # Print the unsorted array
- mov rdi, OFFSET unsorted
- xor rax, rax
- call printf
- mov rdi, rsp
- mov rsi, array_len
- call print_array
- # Sort
- mov rdi, rsp
- mov rsi, array_len
- call bogo_sort
- # Print the sorted array
- mov rdi, OFFSET sorted
- xor rax, rax
- call printf
- mov rdi, rsp
- mov rsi, array_len
- call print_array
- # Restore the stack pointer, set return value to 0
- add rsp, 40
- xor rax, rax
- ret
-
diff --git a/contents/bogo_sort/code/bash/bogo_sort.bash b/contents/bogo_sort/code/bash/bogo_sort.bash
deleted file mode 100755
index 43135075f..000000000
--- a/contents/bogo_sort/code/bash/bogo_sort.bash
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/env bash
-is_sorted() {
- local arr
- local len
- local i
- local sorted
- arr=("$@")
- (( len = ${#arr[@]} - 1))
- (( sorted = 1 ))
-
- for (( i = len; i > 0; i-- )); do
- if (( arr[i] < arr[(( i - 1 ))] )); then
- (( sorted = 0 ))
- break
- fi
- done
- printf "%d" $sorted
-}
-
-shuffle() {
- local arr
- local len
- local i
- local tmp
- local rand
- arr=("$@")
- (( len = ${#arr[@]} ))
-
- for (( i = 0; i < len; i++ )); do
- (( rand = RANDOM % len ))
- (( tmp = arr[rand] ))
- (( arr[rand] = arr[i] ))
- (( arr[i] = tmp ))
- done
- echo ${arr[*]}
-}
-
-bogo_sort() {
- local arr
- arr=("$@")
- while [[ $(is_sorted "${arr[@]}") == 0 ]]; do
- arr=($(shuffle "${arr[@]}"))
- done
- echo ${arr[*]}
-}
-
-arr=(1 3654 78 654 -234 -12 4 3 -6 -100)
-echo "Unsorted array: ${arr[*]}"
-arr=("$(bogo_sort "${arr[@]}")")
-echo "Sorted array: ${arr[*]}"
diff --git a/contents/bogo_sort/code/c++/bogosort.cpp b/contents/bogo_sort/code/c++/bogosort.cpp
deleted file mode 100644
index f4ce66934..000000000
--- a/contents/bogo_sort/code/c++/bogosort.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-
-using std::begin;
-using std::end;
-
-template
-std::vector generate_input(std::size_t size, Rng& rng) {
- auto dist = std::uniform_real_distribution<>(0.0, 1.0);
-
- auto ret = std::vector();
- std::generate_n(std::back_inserter(ret), size,
- [&rng, &dist] { return dist(rng); });
-
- return ret;
-}
-
-template
-void print_range(std::ostream& os, Iter const first, Iter const last) {
- os << '{';
-
- if (first != last) {
- os << *first;
- std::for_each(first + 1, last, [&os] (double d) { os << ", " << d; });
- }
-
- os << "}\n";
-}
-
-template
-void bogo_sort(Iter const first, Iter const last, Rng& rng) {
- while (not std::is_sorted(first, last)) {
- std::shuffle(first, last, rng);
- }
-}
-
-int main() {
- std::random_device random_device;
- auto rng = std::mt19937(random_device());
-
- auto input = generate_input(5, rng);
-
- print_range(std::cout, begin(input), end(input));
-
- bogo_sort(begin(input), end(input), rng);
-
- print_range(std::cout, begin(input), end(input));
-}
diff --git a/contents/bogo_sort/code/c/bogo_sort.c b/contents/bogo_sort/code/c/bogo_sort.c
deleted file mode 100644
index 0081a86a8..000000000
--- a/contents/bogo_sort/code/c/bogo_sort.c
+++ /dev/null
@@ -1,47 +0,0 @@
-#include
-#include
-#include
-#include
-
-bool is_sorted(int *array, size_t n) {
- while (--n >= 1) {
- if (array[n] < array[n - 1]) {
- return false;
- }
- }
-
- return true;
-}
-
-void shuffle(int *array, size_t n) {
- for (size_t i = 0; i < n; ++i) {
- int t = array[i];
- int r = rand() % n;
- array[i] = array[r];
- array[r] = t;
- }
-}
-
-void bogo_sort(int *array, size_t n) {
- while (!is_sorted(array, n)) {
- shuffle(array, n);
- }
-}
-
-int main() {
- int array[10] = {1, 3654, 78, 654, -234, -12, 4, 3, -6, -100};
-
- printf("Unsorted array:\n");
- for (int i = 0; i < 10; ++i) {
- printf("%d ", array[i]);
- }
- printf("\n\n");
-
- bogo_sort(array, 10);
-
- printf("Sorted array:\n");
- for (int i = 0; i < 10; ++i) {
- printf("%d ", array[i]);
- }
- printf("\n");
-}
diff --git a/contents/bogo_sort/code/clisp/bogo-sort.lisp b/contents/bogo_sort/code/clisp/bogo-sort.lisp
deleted file mode 100644
index dae143bab..000000000
--- a/contents/bogo_sort/code/clisp/bogo-sort.lisp
+++ /dev/null
@@ -1,26 +0,0 @@
-;;;; Bogo sort implementation
-
-(defun sortedp (list)
- "Checks if a list is sorted"
- (if (< (length list) 2)
- t
- (if (<= (first list) (second list))
- (sortedp (rest list))
- nil)))
-
-(defun shuffle (list)
- "Returns a shuffled list using the Fisher-Yates method"
- (loop for i from (1- (length list)) downto 0
- do
- (rotatef
- (nth i list)
- (nth (random (1+ i)) list))
- finally (return list)))
-
-(defun bogo-sort (list)
- "Sorts a given list (eventually)"
- (if (sortedp list)
- list
- (bogo-sort (shuffle list))))
-
-(print (bogo-sort (list 1 3 2 4)))
diff --git a/contents/bogo_sort/code/clojure/bogo.clj b/contents/bogo_sort/code/clojure/bogo.clj
deleted file mode 100644
index d9f575251..000000000
--- a/contents/bogo_sort/code/clojure/bogo.clj
+++ /dev/null
@@ -1,11 +0,0 @@
-;; earthfail
-(defn is-sorted [col func]
- "return true of col is sorted in respect to func role
- like <,>,<=,>="
- (apply func col))
-
-(defn bogo-sort [col func]
- "shuffle the collection untill it is sorted"
- (if (is-sorted col func)
- col
- (shuffle col)))
diff --git a/contents/bogo_sort/code/coconut/bogo.coco b/contents/bogo_sort/code/coconut/bogo.coco
deleted file mode 100644
index bc467bafb..000000000
--- a/contents/bogo_sort/code/coconut/bogo.coco
+++ /dev/null
@@ -1,15 +0,0 @@
-import random
-
-
-is_sorted = l -> (l, l[1:]) |*> zip |> map$(t -> t[0] <= t[1]) |> all
-
-def bogo_sort(a):
- while not is_sorted(a):
- random.shuffle(a)
-
-
-if __name__ == '__main__':
- a = [1, 3, 2, 4]
- print('Unsorted:', a)
- bogo_sort(a)
- print('Sorted:', a)
diff --git a/contents/bogo_sort/code/crystal/bogo.cr b/contents/bogo_sort/code/crystal/bogo.cr
deleted file mode 100644
index 8d622d567..000000000
--- a/contents/bogo_sort/code/crystal/bogo.cr
+++ /dev/null
@@ -1,22 +0,0 @@
-def is_sorted?(a)
- 0.upto(a.size - 2) do |i|
- if a[i] > a[i + 1]
- return false
- end
- end
- true
-end
-
-def bogo_sort!(a)
- while !is_sorted?(a)
- a.shuffle!
- end
-end
-
-def main
- a = [1.0, 3.0, 2.0, 4.0]
- bogo_sort!(a)
- puts a
-end
-
-main
diff --git a/contents/bogo_sort/code/csharp/BogoSort.cs b/contents/bogo_sort/code/csharp/BogoSort.cs
deleted file mode 100644
index 3d5e981c3..000000000
--- a/contents/bogo_sort/code/csharp/BogoSort.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-// submitted by Julian Schacher (jspp)
-using System;
-using System.Collections.Generic;
-
-namespace BogoSort
-{
- public static class BogoSort
- {
- public static List RunBogoSort(List list) where T : IComparable
- {
- while (!IsSorted(list))
- list = Shuffle(list, new Random());
-
- return list;
- }
-
- private static bool IsSorted(List list) where T : IComparable
- {
- var sorted = true;
-
- for (int i = 0; i < list.Count - 1; i++)
- {
- if (!(0 >= list[i].CompareTo(list[i + 1])))
- sorted = false;
- }
- if (!sorted)
- {
- sorted = true;
- for (int i = 0; i < list.Count - 1; i++)
- {
- if (!(0 <= list[i].CompareTo(list[i + 1])))
- sorted = false;
- }
- }
-
- return sorted;
- }
-
- private static List Shuffle(List list, Random random)
- {
- for (int i = list.Count - 1; i > 0; i--)
- {
- var j = random.Next(0, i);
- var temp = list[i];
- list[i] = list[j];
- list[j] = temp;
- }
- return list;
- }
- }
-}
diff --git a/contents/bogo_sort/code/csharp/Program.cs b/contents/bogo_sort/code/csharp/Program.cs
deleted file mode 100644
index 66cc135e6..000000000
--- a/contents/bogo_sort/code/csharp/Program.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-// submitted by Julian Schacher (jspp)
-using System;
-using System.Collections.Generic;
-
-namespace BogoSort
-{
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("BogoSort");
- var listBogo = new List() { 1, 2, 6, 4, 9, 54, 3, 2, 7, 15 };
- Console.Write("unsorted: ");
- foreach (var number in listBogo)
- Console.Write(number + " ");
- Console.WriteLine();
- listBogo = BogoSort.RunBogoSort(listBogo);
- Console.Write("sorted: ");
- foreach (var number in listBogo)
- Console.Write(number + " ");
- Console.WriteLine();
- }
- }
-}
diff --git a/contents/bogo_sort/code/emojicode/bogo_sort.emojic b/contents/bogo_sort/code/emojicode/bogo_sort.emojic
deleted file mode 100644
index ce95e1b84..000000000
--- a/contents/bogo_sort/code/emojicode/bogo_sort.emojic
+++ /dev/null
@@ -1,32 +0,0 @@
-π π₯ π
- π βοΈ π numbers π¨ππ―π π
- π β πΆππ₯ numbersβοΈβοΈ π
- πΉ numbersβοΈ
- π
- π
-
- π βοΈ πΆ numbers π¨ππ―π β‘οΈ π π
- π i πβ©β©οΈ 1 π numbersβοΈβοΈ π
- βͺοΈ π½ numbers i β 1βοΈ βΆοΈ π½ numbers iβοΈ π
- β©οΈ π
- π
- π
- β©οΈ π
- π
-π
-
-π π
- π¨ 1.7 -3.0 2.5 2.0 7.0 1.5 -4.3 0.3 π β‘οΈ numbers
-
- π π€unordered:π€βοΈ
- π number numbers π
- π π‘ number 10βοΈβοΈ
- π
-
- πππ₯ numbersβοΈ
-
- π π€ordered:π€βοΈ
- π number numbers π
- π π‘ number 10βοΈβοΈ
- π
-π
diff --git a/contents/bogo_sort/code/factor/bogo_sort.factor b/contents/bogo_sort/code/factor/bogo_sort.factor
deleted file mode 100644
index 44515b56a..000000000
--- a/contents/bogo_sort/code/factor/bogo_sort.factor
+++ /dev/null
@@ -1,25 +0,0 @@
-! There's no built-in "is sorted" function, so let's make one:
-USING: locals ;
-: sorted? ( seq -- ? )
- 2 clump ! split it up into overlapping pairs
- ! so now, for example, { 1 2 3 } has turned into { { 1 2 } { 2 3 } }
- ! and now we make sure that for every pair, the latter is >= the former
- [| pair | pair first pair last <= ] all?
-;
-
-USING: random ;
-: bogosort ( seq -- seq' )
- ! `dup` duplicates the array, because `sorted?` pops its reference to it
- ! randomize works in-place
- ! so we `randomize` `until` it's `sorted?`
- [ dup sorted? ] [ randomize ] until
-;
-
-! WARNING: Increasing this number beyond 5 or so will make this take a very long time.
-! That said, if you have an afternoon to kill...
-5 >array randomize ! generate a random array to demo
-dup . ! show the array
-bogosort ! bogosort it
-. ! show it again
-
-
diff --git a/contents/bogo_sort/code/fortran/bogo.f90 b/contents/bogo_sort/code/fortran/bogo.f90
deleted file mode 100644
index 87a7ab9ff..000000000
--- a/contents/bogo_sort/code/fortran/bogo.f90
+++ /dev/null
@@ -1,48 +0,0 @@
-PROGRAM bogo
- IMPLICIT NONE
- REAL(8), DIMENSION(5) :: array
-
- array = (/ 1d0, 1d0, 0d0, 3d0, 7d0 /)
-
- CALL bogo_sort(array)
-
- WRITE(*,*) array
-
-contaINs
-
- LOGICAL FUNCTION is_sorted(array)
- REAL(8), DIMENSION(:), INTENT(IN) :: array
- INTEGER :: i
-
- DO i = 1, SIZE(array)
- IF (array(i+1) < array(i)) THEN
- is_sorted = .FALSE.
- END IF
- END DO
- END FUNCTION is_sorted
-
- SUBROUTINE bogo_sort(array)
- REAL(8), DIMENSION(:), INTENT(INOUT) :: array
-
- DO WHILE (is_sorted(array) .EQV. .FALSE.)
-
- CALL shuffle(array)
-
- END DO
- END SUBROUTINE bogo_sort
-
- SUBROUTINE shuffle(array)
- REAL(8), DIMENSION(:), INTENT(INOUT) :: array
- INTEGER :: i, randpos
- REAL(8) :: r, temp
-
- DO i = size(array), 2, -1
- CALL RANDOM_NUMBER(r)
- randpos = INT(r * i) + 1
- temp = array(randpos)
- array(randpos) = array(i)
- array(i) = temp
- END DO
-
- END SUBROUTINE shuffle
-END PROGRAM bogo
diff --git a/contents/bogo_sort/code/go/bogo_sort.go b/contents/bogo_sort/code/go/bogo_sort.go
deleted file mode 100644
index ac54caa5c..000000000
--- a/contents/bogo_sort/code/go/bogo_sort.go
+++ /dev/null
@@ -1,38 +0,0 @@
-// Submitted by Christopher Milan (christopherm99)
-
-package main
-
-import (
- "fmt"
- "math/rand"
- "time"
-)
-
-func shuffle(a []int) {
- for i := len(a) - 1; i > 0; i-- {
- j := rand.Intn(i + 1)
- a[i], a[j] = a[j], a[i]
- }
-}
-
-func isSorted(a []int) bool {
- for i := 0; i < len(a)-1; i++ {
- if a[i+1] < a[i] {
- return false
- }
- }
- return true
-}
-
-func bogoSort(a []int) {
- for !isSorted(a) {
- shuffle(a)
- }
-}
-
-func main() {
- rand.Seed(time.Now().UnixNano())
- a := []int{1, 3, 4, 2}
- bogoSort(a)
- fmt.Println(a)
-}
diff --git a/contents/bogo_sort/code/haskell/bogoSort.hs b/contents/bogo_sort/code/haskell/bogoSort.hs
deleted file mode 100644
index 328e192cc..000000000
--- a/contents/bogo_sort/code/haskell/bogoSort.hs
+++ /dev/null
@@ -1,24 +0,0 @@
-import System.Random
-import qualified Data.Map as M
-import Data.Map ((!))
-
-fisherYates :: RandomGen g => [a] -> g -> ([a], g)
-fisherYates a gen = shuffle 1 gen m
- where m = M.fromList $ zip [1..] a
- shuffle i g k
- | i == M.size m = (M.elems k, g)
- | otherwise = let (j, g') = randomR (i, M.size m) g
- k' = M.insert i (k!j) $ M.insert j (k!i) k
- in shuffle (i+1) g' k'
-
-isSorted :: Ord a => [a] -> Bool
-isSorted = all (uncurry (<=)) . (zip <*> tail)
-
-bogoSort :: (Ord a, RandomGen g) => g -> [a] -> [a]
-bogoSort g a = fst $ head $
- filter (isSorted . fst) $
- iterate (uncurry fisherYates) (a, g)
-
-main = do
- g <- newStdGen
- print $ bogoSort g [9, 4, 3, 2, 5, 8, 6, 1, 7]
diff --git a/contents/bogo_sort/code/java/Bogo.java b/contents/bogo_sort/code/java/Bogo.java
deleted file mode 100644
index 556543641..000000000
--- a/contents/bogo_sort/code/java/Bogo.java
+++ /dev/null
@@ -1,46 +0,0 @@
-public class Bogo {
- static void bogoSort(int[] arr) {
- while(!isSorted(arr)) {
- shuffle(arr);
- }
- }
-
- static boolean isSorted(int[] arr) {
- for (int i = 0; i < arr.length - 1; i++) {
- if(arr[i] > arr[i + 1]) {
- return false;
- }
- }
-
- return true;
- }
-
- static void shuffle(int[] arr) {
- for (int r = arr.length - 1; r > 0; r--) {
- int i = (int) Math.floor(Math.random() * r);
- int tmp = arr[i];
- arr[i] = arr[r];
- arr[r] = tmp;
- }
- }
-
-
- public static void main(String[] args) {
- int[] test = new int[]{20, -3, 50, 1, -6, 59};
-
- System.out.println("Unsorted array :");
- for (int i = 0; i < test.length; i++) {
- System.out.print(test[i] + " ");
- }
-
-
- bogoSort(test);
-
-
- System.out.println("\n\nSorted array :");
- for (int i = 0; i < test.length; i++) {
- System.out.print(test[i] + " ");
- }
- System.out.println("");
- }
-}
diff --git a/contents/bogo_sort/code/javascript/bogo.js b/contents/bogo_sort/code/javascript/bogo.js
deleted file mode 100644
index 2559632e8..000000000
--- a/contents/bogo_sort/code/javascript/bogo.js
+++ /dev/null
@@ -1,32 +0,0 @@
-function isSorted(arr) {
- for (let i = 0; i < arr.length - 1; i++) {
- if (arr[i] > arr[i + 1]) {
- return false;
- }
- }
-
- return true;
-}
-
-function bogoSort(arr) {
- while (!isSorted(arr)) {
- shuffle(arr);
- }
-}
-
-function shuffle(arr) {
- for (let r = arr.length -1; r > 0; r--) {
- let i = Math.floor(Math.random() * r);
- let tmp = arr[i];
- arr[i] = arr[r];
- arr[r] = tmp;
- }
-}
-
-function main() {
- const testArray = [4, 5, 123, 24, 34, -5];
- bogoSort(testArray);
- console.log(testArray);
-}
-
-main();
diff --git a/contents/bogo_sort/code/julia/bogo.jl b/contents/bogo_sort/code/julia/bogo.jl
deleted file mode 100644
index d07cdb6a7..000000000
--- a/contents/bogo_sort/code/julia/bogo.jl
+++ /dev/null
@@ -1,24 +0,0 @@
-using Random
-
-function is_sorted(a::Vector{Float64})
- for i = 1:length(a)-1
- if (a[i] > a[i + 1])
- return false
- end
- end
- return true
-end
-
-function bogo_sort!(a::Vector{Float64})
- while(!is_sorted(a))
- shuffle!(a)
- end
-end
-
-function main()
- a = [1.0, 3.0, 2.0, 4.0]
- bogo_sort!(a)
- println(a)
-end
-
-main()
diff --git a/contents/bogo_sort/code/lua/bogosort.lua b/contents/bogo_sort/code/lua/bogosort.lua
deleted file mode 100644
index 501171d15..000000000
--- a/contents/bogo_sort/code/lua/bogosort.lua
+++ /dev/null
@@ -1,28 +0,0 @@
-local function shuffle(arr)
- for i = 1, #arr-1 do
- local rand = math.random(i,#arr)
- arr[i], arr[rand] = arr[rand], arr[i]
- end
-end
-
-local function is_sorted(arr)
- for i = 1,#arr-1 do
- if arr[i] > arr[i+1] then
- return false
- end
- end
- return true
-end
-
-local function bogo_sort(arr)
- while not is_sorted(arr) do
- shuffle(arr)
- end
-end
-
-local arr = {1, 45, 756, 4569, 56, 3, 8, 5, -10, -4}
-print(("Unsorted array: {%s}"):format(table.concat(arr,", ")))
-
-bogo_sort(arr)
-
-print(("Sorted array: {%s}"):format(table.concat(arr,", ")))
diff --git a/contents/bogo_sort/code/matlab/bogosort.m b/contents/bogo_sort/code/matlab/bogosort.m
deleted file mode 100644
index eeff29adb..000000000
--- a/contents/bogo_sort/code/matlab/bogosort.m
+++ /dev/null
@@ -1,30 +0,0 @@
-function main()
- array = floor( rand(1,7)*100 );
- disp('Before Sorting:')
- disp(array)
-
- array = bogo_sort(array);
- disp('After Sorting')
- disp(array)
-end
-
-function retval = is_sorted(array)
- for i=1:length(array)-1
- if array(i) > array(i+1)
- retval = false;
- return
- end
- end
- retval = true;
-end
-
-function sorted_array = bogo_sort(array)
- while ~is_sorted(array)
- % create a list of random permutation indices
- i = randperm(length(array));
- array = array(i);
- end
- sorted_array = array;
-end
-
-
diff --git a/contents/bogo_sort/code/nim/bogo_sort.nim b/contents/bogo_sort/code/nim/bogo_sort.nim
deleted file mode 100644
index 9f4838a6c..000000000
--- a/contents/bogo_sort/code/nim/bogo_sort.nim
+++ /dev/null
@@ -1,25 +0,0 @@
-import random
-
-randomize()
-
-proc print_array(a: openArray[int]) =
- for n in 0 .. len(a)-1:
- echo a[n]
-
-func is_sorted(a: openArray[int]): bool =
- result = true
- for n in 1 .. len(a)-1:
- if a[n] > a[n-1]:
- result = false
- break
-
-proc bogo_sort(a: var openArray[int]) =
- while not is_sorted(a):
- shuffle(a)
-
-when isMainModule:
- var x = [32, 32, 64, 16, 128, 8, 256, 4, 512, 2]
- print_array(x)
- bogo_sort(x)
- echo "\n"
- print_array(x)
diff --git a/contents/bogo_sort/code/php/bogo_sort.php b/contents/bogo_sort/code/php/bogo_sort.php
deleted file mode 100644
index 41ceb5b99..000000000
--- a/contents/bogo_sort/code/php/bogo_sort.php
+++ /dev/null
@@ -1,31 +0,0 @@
- $array[$i + 1]) {
- return false;
- }
- }
-
- return true;
-}
-
-function bogo_sort(array $array): array
-{
- while (!is_sorted($array)) {
- shuffle($array);
- }
-
- return $array;
-}
-
-
-$unsorted = [10, 7, 3, 1, 4, 8, 5, 6, 9, 2];
-$bogo_sorted = bogo_sort($unsorted);
-
-printf('Unsorted: %s', implode(',', $unsorted));
-echo PHP_EOL;
-printf('Sorted: %s', implode(',', $bogo_sorted));
-echo PHP_EOL;
diff --git a/contents/bogo_sort/code/python/bogo.py b/contents/bogo_sort/code/python/bogo.py
deleted file mode 100644
index 995a0ce8c..000000000
--- a/contents/bogo_sort/code/python/bogo.py
+++ /dev/null
@@ -1,20 +0,0 @@
-import random
-
-
-def is_sorted(a):
- for i in range(len(a)-1):
- if a[i+1] < a[i]:
- return False
- return True
-
-def bogo_sort(a):
- while not is_sorted(a):
- random.shuffle(a)
-
-def main():
- a = [1, 3, 2, 4]
- bogo_sort(a)
- print(a)
-
-main()
-
diff --git a/contents/bogo_sort/code/r/bogo_sort.r b/contents/bogo_sort/code/r/bogo_sort.r
deleted file mode 100755
index 0d354de27..000000000
--- a/contents/bogo_sort/code/r/bogo_sort.r
+++ /dev/null
@@ -1,15 +0,0 @@
-bogo_sort <- function(a) {
- while(is.unsorted(a)) {
- a <- sample(a)
- }
- return(a)
-}
-
-test <- c(20, -3, 50, 1, -6, 59)
-
-print("unsorted list")
-print(test)
-
-print("sorted list")
-print(bogo_sort(test))
-
diff --git a/contents/bogo_sort/code/racket/bogo_sort.rkt b/contents/bogo_sort/code/racket/bogo_sort.rkt
deleted file mode 100755
index dfc3b1c70..000000000
--- a/contents/bogo_sort/code/racket/bogo_sort.rkt
+++ /dev/null
@@ -1,24 +0,0 @@
-#lang racket
-
-(define (bogo_sort l)
- (if (is_sorted? l)
- l
- (bogo_sort (shuffle l))
- )
- )
-
-(define (is_sorted? l)
- (if (> (length l) 1)
- (if (> (first l) (second l))
- false
- (is_sorted? (rest l))
- )
- true
- )
- )
-
-(define unsorted_list '(20 -3 50 1 -6 59))
-(display "unsorted list: ")
-(displayln unsorted_list)
-(display "sorted list: ")
-(displayln (bogo_sort unsorted_list))
diff --git a/contents/bogo_sort/code/ruby/bogo.rb b/contents/bogo_sort/code/ruby/bogo.rb
deleted file mode 100644
index 13e4ae447..000000000
--- a/contents/bogo_sort/code/ruby/bogo.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/usr/bin/env ruby
-
-def is_sorted(a)
- a.each_cons(2).all? { |(l, r)| l <= r }
-end
-
-def bogo_sort(a)
- a.shuffle! until is_sorted a
-end
-
-a = [1, 1, 0, 3, 7]
-
-puts "Unsorted"
-p a
-
-bogo_sort a
-
-puts "Sorted"
-p a
diff --git a/contents/bogo_sort/code/rust/bogosort.rs b/contents/bogo_sort/code/rust/bogosort.rs
deleted file mode 100644
index 78c12323f..000000000
--- a/contents/bogo_sort/code/rust/bogosort.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-// Submitted by jess 3jane
-
-extern crate rand;
-
-use rand::{thread_rng, Rng};
-
-fn is_sorted(arr: &[i32]) -> bool {
- for i in 1..arr.len() {
- if arr[i - 1] > arr[i] {
- return false;
- }
- }
- true
-}
-
-fn bogo_sort(arr: &mut [i32]) {
- while !is_sorted(arr) {
- thread_rng().shuffle(arr);
- }
-}
-
-fn main() {
- let mut v = vec![1, 2, 3, 4, 5];
- thread_rng().shuffle(&mut v);
- println!("Original array: {:?}", v);
- bogo_sort(&mut v);
- println!("Sorted array: {:?}", v);
-}
diff --git a/contents/bogo_sort/code/scala/bogo.scala b/contents/bogo_sort/code/scala/bogo.scala
deleted file mode 100644
index 25bd9d729..000000000
--- a/contents/bogo_sort/code/scala/bogo.scala
+++ /dev/null
@@ -1,25 +0,0 @@
-import scala.util.Random.shuffle
-
-object BogoSort {
-
- def isSorted(list: List[Int]): Boolean =
- list match {
- case Nil => true
- case a :: b :: _ if a > b => false
- case _ :: tail => isSorted(tail)
- }
-
- def bogoSort(list: List[Int]): List[Int] =
- isSorted(list) match {
- case false => bogoSort(shuffle(list))
- case _ => list
- }
-
- def main(args: Array[String]): Unit = {
- val unsorted = List(5, 2, 7, 1, -5)
-
- println("Unsorted list is " + unsorted)
- println(" Sorted list is " + bogoSort(unsorted))
- }
-
-}
diff --git a/contents/bogo_sort/code/smalltalk/bogosort.st b/contents/bogo_sort/code/smalltalk/bogosort.st
deleted file mode 100644
index 73d0ced6d..000000000
--- a/contents/bogo_sort/code/smalltalk/bogosort.st
+++ /dev/null
@@ -1,9 +0,0 @@
-"Add this to the SequenceableCollection: "
-SequenceableCollection>>bogoSort
- "A simple bogosort."
- [ self isSorted ] whileFalse: [
- self shuffle.
- ]
-
-"Then you can run this anywhere: "
-#(4 3 2 1 6 5) bogoSort "#(1 2 3 4 5 6)"
diff --git a/contents/bogo_sort/code/swift/bogosort.swift b/contents/bogo_sort/code/swift/bogosort.swift
deleted file mode 100644
index df340778e..000000000
--- a/contents/bogo_sort/code/swift/bogosort.swift
+++ /dev/null
@@ -1,26 +0,0 @@
-import Foundation
-
-func isSorted(inputArray: [Int]) -> Bool {
- for i in 0.. inputArray[i+1] {
- return false
- }
- }
-
- return true
-}
-
-func bogoSort(sortArray: inout [Int]) -> [Int] {
- while(!isSorted(inputArray: sortArray)) {
- sortArray.shuffle()
- }
-
- return sortArray
-}
-
-func main() {
- var testArray = [4,5,123,24,34,-5]
- print(bogoSort(sortArray: &testArray))
-}
-
-main()
diff --git a/contents/bubble_sort/bubble_sort.md b/contents/bubble_sort/bubble_sort.md
deleted file mode 100644
index 27071de4a..000000000
--- a/contents/bubble_sort/bubble_sort.md
+++ /dev/null
@@ -1,187 +0,0 @@
-# Bubble Sort
-When it comes to sorting algorithms, Bubble Sort is usually the first that comes to mind.
-Though it might not be the fastest tool in the shed, it's definitely straightforward to implement and is often the first sorting method new programmers think of when trying to implement a sorting method on their own.
-
-Here's how it works: we go through each element in our vector and check to see if it is larger than the element to it's right.
-If it is, we swap the elements and then move to the next element.
-In this way, we sweep through the array $$n$$ times for each element and continually swap any two adjacent elements that are improperly ordered.
-This means that we need to go through the vector $$\mathcal{O}(n^2)$$ times with code similar to the following:
-
-{% method %}
-{% sample lang="jl" %}
-[import:1-10, lang:"julia"](code/julia/bubble.jl)
-{% sample lang="cs" %}
-[import:9-27, lang:"csharp"](code/csharp/BubbleSort.cs)
-{% sample lang="c" %}
-[import:10-20, lang:"c"](code/c/bubble_sort.c)
-{% sample lang="c8" %}
-[import:39-63, lang:"chip-8"](code/chip8/bubblesort.c8)
-{% sample lang="java" %}
-[import:2-12, lang:"java"](code/java/Bubble.java)
-{% sample lang="kotlin" %}
-[import:1-11, lang:"kotlin"](code/kotlin/BubbleSort.kt)
-{% sample lang="js" %}
-[import:1-12, lang:"javascript"](code/javascript/bubble.js)
-{% sample lang="py" %}
-[import:4-9, lang:"python"](code/python/bubblesort.py)
-{% sample lang="m" %}
-[import:1-13, lang:"matlab"](code/matlab/bubblesort.m)
-{% sample lang="lua" %}
-[import:1-9, lang="lua"](code/lua/bubble_sort.lua)
-{% sample lang="hs" %}
-[import, lang:"haskell"](code/haskell/bubbleSort.hs)
-{% sample lang="cpp" %}
-[import:13-23, lang:"cpp"](code/c++/bubblesort.cpp)
-{% sample lang="rs" %}
-[import:6-16, lang:"rust"](code/rust/bubble_sort.rs)
-{% sample lang="d" %}
-[import:3-18, lang:"d"](code/d/bubble_sort.d)
-{% sample lang="go" %}
-[import:7-21, lang:"go"](code/go/bubbleSort.go)
-{% sample lang="racket" %}
-[import:6-19, lang:"scheme"](code/racket/bubbleSort.rkt)
-{% sample lang="swift" %}
-[import:1-13, lang:"swift"](code/swift/bubblesort.swift)
-{% sample lang="ti83b" %}
-[import:2-13, lang:"ti-83_basic"](code/ti83basic/BUBLSORT.txt)
-{% sample lang="ruby" %}
-[import:3-13, lang:"ruby"](code/ruby/bubble.rb)
-{% sample lang="crystal" %}
-[import:1-11, lang:"crystal"](code/crystal/bubble.cr)
-{% sample lang="php" %}
-[import:4-17, lang:"php"](code/php/bubble_sort.php)
-{% sample lang="lisp" %}
-[import:3-28, lang:"lisp"](code/clisp/bubble_sort.lisp)
-{% sample lang="nim" %}
-[import:5-9, lang:"nim"](code/nim/bubble_sort.nim)
-{% sample lang="st" %}
-[import:2-15, lang:"smalltalk"](code/smalltalk/bubble.st)
-{% sample lang="asm-x64" %}
-[import:43-66, lang:"asm-x64"](code/asm-x64/bubble_sort.s)
-{% sample lang="f90" %}
-[import:19-40, lang:"fortran"](code/fortran/bubble.f90)
-{% sample lang="bf" %}
-[import:17-63, lang:"brainfuck"](code/brainfuck/bubblesort.bf)
-{% sample lang="scala" %}
-[import:3-14, lang:"scala"](code/scala/bubble_sort.scala)
-{% sample lang="emojic" %}
-[import:2-14, lang:"emojicode"](code/emojicode/bubble_sort.emojic)
-{% sample lang="bash" %}
-[import:2-21, lang:"bash"](code/bash/bubble_sort.bash)
-{% sample lang="v" %}
-[import:1-11, lang:"v"](code/v/bubble_sort.v)
-{% sample lang="scratch" %}
-
-
-
-{% sample lang="coffee" %}
-[import:1-6, lang:"coffeescript"](code/coffeescript/bubblesort.coffee)
-{% sample lang="r" %}
-[import:1-12, lang:"r"](code/r/bubble_sort.R)
-{% sample lang="coco" %}
-[import:3-10, lang:"coconut"](code/coconut/bubblesort.coco)
-{% endmethod %}
-
-... And that's it for the simplest bubble sort method.
-Now, as you might imagine, computer scientists have optimized this to the fiery lakes of Michigan and back, so we'll come back to this in the future and talk about how to optimize it.
-For now, it's fine to just bask in the simplicity that is bubble sort.
-Trust me, there are plenty of more complicated algorithms that do precisely the same thing, only much, much better (for most cases).
-
-## Example Code
-
-{% method %}
-{% sample lang="jl" %}
-[import, lang:"julia"](code/julia/bubble.jl)
-{% sample lang="cs" %}
-##### BubbleSort.cs
-[import, lang:"csharp"](code/csharp/BubbleSort.cs)
-##### Program.cs
-[import, lang:"csharp"](code/csharp/Program.cs)
-{% sample lang="c" %}
-[import, lang:"c"](code/c/bubble_sort.c)
-{% sample lang="c8" %}
-[import, lang:"chip-8"](code/chip8/bubblesort.c8)
-{% sample lang="java" %}
-[import, lang:"java"](code/java/Bubble.java)
-{% sample lang="kotlin" %}
-[import, lang:"kotlin"](code/kotlin/BubbleSort.kt)
-{% sample lang="js" %}
-[import, lang:"javascript"](code/javascript/bubble.js)
-{% sample lang="py" %}
-[import, lang:"python"](code/python/bubblesort.py)
-{% sample lang="m" %}
-[import, lang:"matlab"](code/matlab/bubblesort.m)
-{% sample lang="lua" %}
-[import, lang="lua"](code/lua/bubble_sort.lua)
-{% sample lang="hs" %}
-[import, lang:"haskell"](code/haskell/bubbleSort.hs)
-{% sample lang="cpp" %}
-[import, lang:"cpp"](code/c++/bubblesort.cpp)
-{% sample lang="rs" %}
-[import, lang:"rust"](code/rust/bubble_sort.rs)
-{% sample lang="d" %}
-[import, lang:"d"](code/d/bubble_sort.d)
-{% sample lang="go" %}
-[import, lang:"go"](code/go/bubbleSort.go)
-{% sample lang="racket" %}
-[import, lang:"scheme"](code/racket/bubbleSort.rkt)
-{% sample lang="swift" %}
-[import, lang:"swift"](code/swift/bubblesort.swift)
-{% sample lang="ti83b" %}
-[import, lang:"ti-83_basic"](code/ti83basic/BUBLSORT.txt)
-{% sample lang="ruby" %}
-[import, lang:"ruby"](code/ruby/bubble.rb)
-{% sample lang="crystal" %}
-[import, lang:"crystal"](code/crystal/bubble.cr)
-{% sample lang="php" %}
-[import, lang:"php"](code/php/bubble_sort.php)
-{% sample lang="lisp" %}
-[import, lang:"lisp"](code/clisp/bubble_sort.lisp)
-{% sample lang="nim" %}
-[import, lang:"nim"](code/nim/bubble_sort.nim)
-{% sample lang="asm-x64" %}
-[import, lang:"asm-x64"](code/asm-x64/bubble_sort.s)
-{% sample lang="f90" %}
-[import, lang:"fortran"](code/fortran/bubble.f90)
-{% sample lang="bf" %}
-[import, lang:"brainfuck"](code/brainfuck/bubblesort.bf)
-{% sample lang="st" %}
-[import, lang:"smalltalk"](code/smalltalk/bubble.st)
-{% sample lang="scala" %}
-[import, lang:"scala"](code/scala/bubble_sort.scala)
-{% sample lang="emojic" %}
-[import, lang:"emojicode"](code/emojicode/bubble_sort.emojic)
-{% sample lang="bash" %}
-[import, lang:"bash"](code/bash/bubble_sort.bash)
-{% sample lang="v" %}
-[import, lang:"v"](code/v/bubble_sort.v)
-{% sample lang="scratch" %}
-The code snippet was taken from this [Scratch project](https://scratch.mit.edu/projects/316483792)
-{% sample lang="coffee" %}
-[import, lang:"coffeescript"](code/coffeescript/bubblesort.coffee)
-{% sample lang="r" %}
-[import, lang:"r"](code/r/bubble_sort.R)
-{% sample lang="coco" %}
-[import, lang:"coconut"](code/coconut/bubblesort.coco)
-{% endmethod %}
-
-
-
-## License
-
-##### Code Examples
-
-The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)).
-
-##### Text
-
-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).
-
-[
](https://creativecommons.org/licenses/by-sa/4.0/)
-
-##### Pull Requests
-
-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:
-- none
diff --git a/contents/bubble_sort/code/asm-x64/bubble_sort.s b/contents/bubble_sort/code/asm-x64/bubble_sort.s
deleted file mode 100644
index 9521ded40..000000000
--- a/contents/bubble_sort/code/asm-x64/bubble_sort.s
+++ /dev/null
@@ -1,106 +0,0 @@
-.intel_syntax noprefix
-
-.section .rodata
- array:
- .align 16
- .int 1, 45, 756, 4569, 56, 3, 8, 5, -10, -4
- .equ array_len, (.-array) / 4
- array_fmt: .string "%d "
- lf: .string "\n"
- unsorted: .string "Unsorted array: "
- sorted: .string "Sorted array: "
-
-.section .text
- .global main
- .extern printf
-
-print_array:
- push r12
- push r13
-
- mov r12, rdi # Loop variable
- lea r13, [rdi + 4*rsi] # Pointer after the last element
-
-print_array_loop:
- cmp r12, r13 # If we're done iterating over the array then bail
- jge print_array_done
- mov rdi, OFFSET array_fmt # Otherwise print the current value
- mov esi, DWORD PTR [r12]
- xor rax, rax
- call printf
- lea r12, [r12 + 4] # And increment the loop variable pointer
- jmp print_array_loop
-
-print_array_done:
- mov rdi, OFFSET lf # Print a closing newline
- xor rax, rax
- call printf
-
- pop r13
- pop r12
- ret
-
-bubble_sort:
- xor rcx, rcx # The outer loop counter
- lea rdx, [rdi + 4*rsi - 4] # The end address for the inner loop
-
-outer_loop:
- cmp rcx, rsi # We first check if the outer loop is done
- jge bubble_sort_done # And if it is, return
- mov rax, rdi # Otherwise we initialize the loop variable of the inner loop
-inner_loop:
- mov r8d, DWORD PTR [rax] # Load array[j] and array[j+1] through a pointer
- mov r9d, DWORD PTR [rax + 4]
- cmp r8d, r9d # If array[j] <= array[j+1]
- jle loop_counters # Then we can skip this iteration
- mov DWORD PTR [rax], r9d # Otherwise swap the values
- mov DWORD PTR [rax + 4], r8d
-loop_counters:
- lea rax, [rax + 4] # First, advance the inner loop
- cmp rax, rdx
- jl inner_loop # And in case it's not done, repeat
- inc rcx # If it is done, go back to doing the outer loop
- jmp outer_loop
-
-bubble_sort_done:
- ret
-
-main:
- # Set up our stack
- sub rsp, 40
-
- # We load the array in chunks onto the stack
- movaps xmm0, XMMWORD PTR [array]
- movaps XMMWORD PTR [rsp], xmm0
- movaps xmm0, XMMWORD PTR [array + 16]
- movaps XMMWORD PTR [rsp + 16], xmm0
- mov rax, QWORD PTR [array + 32]
- mov QWORD PTR [rsp + 32], rax
-
- # Print the unsorted array
- mov rdi, OFFSET unsorted
- xor rax, rax
- call printf
-
- mov rdi, rsp
- mov rsi, array_len
- call print_array
-
- # Sort
- mov rdi, rsp
- mov rsi, array_len
- call bubble_sort
-
- # Print the sorted array
- mov rdi, OFFSET sorted
- xor rax, rax
- call printf
-
- mov rdi, rsp
- mov rsi, array_len
- call print_array
-
- # Restore the stack pointer, set return value to 0
- add rsp, 40
- xor rax, rax
- ret
diff --git a/contents/bubble_sort/code/bash/bubble_sort.bash b/contents/bubble_sort/code/bash/bubble_sort.bash
deleted file mode 100755
index 78d002760..000000000
--- a/contents/bubble_sort/code/bash/bubble_sort.bash
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env bash
-bubble_sort() {
- local i
- local j
- local tmp
- local len
- local arr
- arr=("$@")
- (( len = ${#arr[@]} ))
-
- for ((i = 0; i <= len - 1; i++)); do
- for ((j = 0; j <= len - 2; j++)); do
- if (( arr[j] > arr[(( j + 1 ))] )); then
- (( tmp = arr[(( j + 1 ))] ))
- (( arr[(( j + 1 ))] = arr[j] ))
- (( arr[j] = tmp ))
- fi
- done
- done
- echo ${arr[*]}
-}
-
-arr=(1 45 756 4569 56 3 8 5 -10 -4)
-echo "Unsorted array: ${arr[*]}"
-tmp=$(bubble_sort "${arr[@]}")
-echo "Sorted array: ${tmp[*]}"
diff --git a/contents/bubble_sort/code/brainfuck/bubblesort.bf b/contents/bubble_sort/code/brainfuck/bubblesort.bf
deleted file mode 100644
index c51c04e0c..000000000
--- a/contents/bubble_sort/code/brainfuck/bubblesort.bf
+++ /dev/null
@@ -1,72 +0,0 @@
-make some extra space for a marker
->>>
-
-build array
->>++++
->>++++++
->>+++++
->>+++
->>+++++++
->>+
->>+++
->>++
-
-move to starting point
->>>
-
-set loop marker to 1 and starts loop
-+
-[
-
-delete loop marker
--<<<<<
-
-if there is a number here
-[
-
-add it to the empty space to the right
-and subtract it from the next number
-[->+>-<<]
-
-undo subtraction once without a zero check in case the numbers are equal
-+>>+<-
-
-then as long as the left number is bigger than zero
-[<+>>
-
-if the number to the right becomes a zero in the process
-due to buffer overflow set a swap marker
-[<<<]<<[<<<<<+>>]
-
-otherwise continue resetting numbers
->>>>>+<-]
-
-set a "correct" marker between numbers
-+
-
-check swap marker
-<<<<<<
-
-if swap marker is set delete "correct" marker
-[->>>>>>->
-
-and swap the numbers
-[-<+>]<<[->>+<<]>[-<+>]
-
-go to next pair
-<<<<<<]>>>
-
-repeat until end of array
-]
-
-go to leftmost "correct" marker
->>>
-
-delete marker and jump to the next one if it's 1
-[->>]
-
-else delete all markers and set repetition marker
->[>[-]>>+<]>]
-
-program stops three places to the right of the
-sorted array
diff --git a/contents/bubble_sort/code/c++/bubblesort.cpp b/contents/bubble_sort/code/c++/bubblesort.cpp
deleted file mode 100644
index 801b5d108..000000000
--- a/contents/bubble_sort/code/c++/bubblesort.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-#include
-#include
-#include
-#include
-
-template
-void print_range(Iter first, Iter last) {
- for (auto it = first; it != last; ++it)
- std::cout << *it << " ";
- std::cout << std::endl;
-}
-
-template
-void bubble_sort(Iter first, Iter last) {
- for (auto it1 = first; it1 != last; ++it1) {
- for (auto it2 = first; it2 + 1 != last; ++it2) {
- // these are unsorted! gotta swap 'em
- if (*(it2 + 1) < *it2) {
- std::iter_swap(it2, it2 + 1);
- }
- }
- }
-}
-
-int main() {
- int input[] = {1, 45, 756, 4569, 56, 3, 8, 5, -10, -4};
-
- std::cout << "Unsorted array:\n";
- print_range(std::begin(input), std::end(input));
-
- bubble_sort(std::begin(input), std::end(input));
-
- std::cout << "\nSorted array:\n";
- print_range(std::begin(input), std::end(input));
-}
diff --git a/contents/bubble_sort/code/c/bubble_sort.c b/contents/bubble_sort/code/c/bubble_sort.c
deleted file mode 100644
index 2cccca129..000000000
--- a/contents/bubble_sort/code/c/bubble_sort.c
+++ /dev/null
@@ -1,35 +0,0 @@
-#include
-
-void print_range(int *array, size_t n) {
- for (size_t i = 0; i < n; ++i) {
- printf("%d ", array[i]);
- }
- printf("\n");
-}
-
-void bubble_sort(int *array, size_t n) {
- for (size_t i = 0; i < n; ++i) {
- for (size_t j = 0; j < n - 1; ++j) {
- if (array[j] > array[j + 1]) {
- int tmp = array[j];
- array[j] = array[j + 1];
- array[j + 1] = tmp;
- }
- }
- }
-}
-
-int main() {
- int array[] = {1, 45, 756, 4569, 56, 3, 8, 5, -10, -4};
- size_t N = sizeof(array) / sizeof(*array);
-
- printf("Unsorted array:\n");
- print_range(array, N);
-
- bubble_sort(array, N);
-
- printf("\nSorted array:\n");
- print_range(array, N);
-
- return 0;
-}
diff --git a/contents/bubble_sort/code/chip8/bubblesort.c8 b/contents/bubble_sort/code/chip8/bubblesort.c8
deleted file mode 100644
index 8aea23d10..000000000
--- a/contents/bubble_sort/code/chip8/bubblesort.c8
+++ /dev/null
@@ -1,70 +0,0 @@
-;chip 8 bubble sort
-;by codingwithethanol
-
-
- LD V2, 1 ;index increment
- LD I, ARRAY ;get array pointer
- LD V3, 12 ;our array will be 12 bytes long
-
-FILL
- RND V0, #0F ;get random byte value from 0-F
- LD [I], V0 ;load it to current array index
- ADD I, V2 ;increment i
- ADD V3, -1 ;decrement counter
- SE V3, #0 ;check if counter has reached zero
- JP FILL ;if it hasnt, loop
- LD V3, 2 ;x position to print array to
- LD V4, 4 ;y position to print array to
- CALL DISPLAY ;display array
- CALL BUBBLESORT ;sort array
-HERE
- JP HERE ;block
-
-DISPLAY
- LD V5, V3 ;save original x offset
- ADD V5, 60 ;add length of array times char width
- LD V2, 0 ;array index
-DRAWLOOP
- LD I, ARRAY ;get array pointer
- ADD I, V2 ;add index
- ADD V2, 1 ;increment index
- LD V0, [I] ;load element of array
- LD F, V0 ;get address of corresponding hex sprite
- DRW V3, V4, 5 ;draw it at (V3, V4)
- ADD V3, 5 ;increment x by char width
- SE V3, V5 ;if we arent at the end of the array
- JP DRAWLOOP ;draw another char
- RET
-
-BUBBLESORT
-SETUP
- LD V4, 0 ;no swap has been performed
- LD V3, 0 ;we are starting at the beginning of the array
-CHECKLOOP
- LD I, ARRAY ;load array pointer
- ADD I, V3 ;load array index
- LD V1, [I] ;load 2 bytes from arraypos
- LD V2, V1 ;temp = b
- SUB V2, V0 ;temp -= a
- SE VF, 0 ;if b < a
- JP GRTHAN ;jump here
-LSTHAN
- LD V2, V1 ;temp = b
- LD V1, V0 ;b = a
- LD V0, V2 ;a = temp
- LD [I], V1 ;store back swapped values
- LD V4, 1 ;swap = true
-GRTHAN
- ADD V3, 1 ;increment array index
- SE V3, 12 ;if not end of array
- JP CHECKLOOP ;step
-CHECKDONE ;if end of array
- SE V4, 0 ;if a swap was done
- JP SETUP ;iterate through array again
- ;otherwise
- LD V3, 2 ;x position to print array to
- LD V4, 12 ;y position to print array to
- CALL DISPLAY ;display sorted array
- RET
-
-ARRAY
diff --git a/contents/bubble_sort/code/clisp/bubble_sort.lisp b/contents/bubble_sort/code/clisp/bubble_sort.lisp
deleted file mode 100644
index 0379355f8..000000000
--- a/contents/bubble_sort/code/clisp/bubble_sort.lisp
+++ /dev/null
@@ -1,33 +0,0 @@
-;;;; Bubble sort implementation
-
-(defun bubble-up (list)
- (if
- (< (length list) 2)
- list
- (if
- (> (first list) (second list))
- (cons
- (second list)
- (bubble-up
- (cons
- (first list)
- (rest (rest list)))))
- (cons
- (first list)
- (bubble-up
- (rest list))))))
-
-(defun bubble-sort (list)
- (if
- (< (length list) 2)
- list
- (let* ((new-list (bubble-up list)))
- (append
- (bubble-sort (butlast new-list))
- (last new-list)))))
-
-;; The built-in sort: (sort (list 5 4 3 2 1) #'<)
-(print
- (bubble-sort (list 5 4 3 2 1)))
-(print
- (bubble-sort (list 1 2 3 3 2 1)))
diff --git a/contents/bubble_sort/code/coconut/bubblesort.coco b/contents/bubble_sort/code/coconut/bubblesort.coco
deleted file mode 100644
index 7bafe1d73..000000000
--- a/contents/bubble_sort/code/coconut/bubblesort.coco
+++ /dev/null
@@ -1,16 +0,0 @@
-import random
-
-def swap_till(x, []) = [x]
-
-addpattern def swap_till(x, y is int) = [min(x, y), max(x, y)]
-
-addpattern def swap_till(x, [y] + rest) =
- [min(x, y)] + swap_till(max(x, y), rest)
-
-bubble_sort = reduce$((x, y) -> swap_till(y, x))
-
-if __name__ == '__main__':
- array = range(10) |> map$(-> random.randint(0, 1000)) |> list
- print('Before sorting:', array)
- array = bubble_sort(array) |> list
- print('After sorting:', array)
diff --git a/contents/bubble_sort/code/coffeescript/bubblesort.coffee b/contents/bubble_sort/code/coffeescript/bubblesort.coffee
deleted file mode 100644
index 632ddd20d..000000000
--- a/contents/bubble_sort/code/coffeescript/bubblesort.coffee
+++ /dev/null
@@ -1,13 +0,0 @@
-bubbleSort = (a) ->
- n = a.length
- for i in [0 .. n]
- for j in [0 .. n - 1]
- if a[j] > a[j + 1]
- [a[j + 1], a[j]] = [a[j], a[j + 1]]
-
-main = () ->
- a = [1, 3, 2, 4, 5, 10, 50, 7, 1.5, 0.3]
- bubble_sort(a)
- console.log(a)
-
-main()
diff --git a/contents/bubble_sort/code/crystal/bubble.cr b/contents/bubble_sort/code/crystal/bubble.cr
deleted file mode 100755
index 187a38744..000000000
--- a/contents/bubble_sort/code/crystal/bubble.cr
+++ /dev/null
@@ -1,20 +0,0 @@
-def bubble_sort(arr)
- arr = arr.dup
- (0 ... arr.size).each do
- (0 ... arr.size-1).each do |k|
- if arr[k] > arr[k+1]
- arr[k+1],arr[k] = arr[k],arr[k+1]
- end
- end
- end
- arr
-end
-
-def main
- number = 10.times.map{rand(0..1_000)}.to_a
- pp "The array before sorting is #{number}"
- number = bubble_sort number
- pp "The array after sorting is #{number}"
-end
-
-main
diff --git a/contents/bubble_sort/code/csharp/BubbleSort.cs b/contents/bubble_sort/code/csharp/BubbleSort.cs
deleted file mode 100644
index 244397b40..000000000
--- a/contents/bubble_sort/code/csharp/BubbleSort.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-// submitted by Julian Schacher (jspp)
-using System;
-using System.Collections.Generic;
-
-namespace BubbleSort
-{
- public static class BubbleSort
- {
- public static List RunBubbleSort(List list) where T : IComparable
- {
- var length = list.Count;
-
- for (int i = 0; i < length; i++)
- {
- for (int j = 1; j < length; j++)
- {
- if (list[j - 1].CompareTo(list[j]) > 0)
- {
- var temp = list[j - 1];
- list[j - 1] = list[j];
- list[j] = temp;
- }
- }
- }
-
- return list;
- }
- }
-}
diff --git a/contents/bubble_sort/code/csharp/Program.cs b/contents/bubble_sort/code/csharp/Program.cs
deleted file mode 100644
index 19fbc94a6..000000000
--- a/contents/bubble_sort/code/csharp/Program.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-// submitted by Julian Schacher (jspp)
-using System;
-using System.Collections.Generic;
-
-namespace BubbleSort
-{
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("BubbleSort");
- var listBubble = new List() { 1, 2, 6, 4, 9, 54, 3, 2, 7, 15 };
- Console.Write("unsorted: ");
- foreach (var number in listBubble)
- Console.Write(number + " ");
- Console.WriteLine();
- listBubble = BubbleSort.RunBubbleSort(listBubble);
- Console.Write("sorted: ");
- foreach (var number in listBubble)
- Console.Write(number + " ");
- Console.WriteLine();
- }
- }
-}
diff --git a/contents/bubble_sort/code/d/bubble_sort.d b/contents/bubble_sort/code/d/bubble_sort.d
deleted file mode 100644
index 7ed957391..000000000
--- a/contents/bubble_sort/code/d/bubble_sort.d
+++ /dev/null
@@ -1,31 +0,0 @@
-import std.range : hasAssignableElements, isRandomAccessRange, hasLength;
-
-void bubbleSort(R)(ref R range)
-if (isRandomAccessRange!R && hasAssignableElements!R && hasLength!R)
-{
- import std.algorithm : swap;
-
- foreach (i; 0 .. range.length) {
- bool isSorted = true;
- foreach (j; 0 .. range.length - 1)
- if (range[j + 1] < range[j]) {
- swap(range[j + 1], range[j]);
- isSorted = false;
- }
- if (isSorted)
- return;
- }
-}
-
-void main() @safe
-{
- import std.stdio : writefln;
- import std.range : generate, take;
- import std.array : array;
- import std.random : uniform01;
-
- auto input = generate!(() => uniform01!float).take(10).array;
- writefln!"before sorting:\n%s"(input);
- bubbleSort(input);
- writefln!"after sorting:\n%s"(input);
-}
diff --git a/contents/bubble_sort/code/emojicode/bubble_sort.emojic b/contents/bubble_sort/code/emojicode/bubble_sort.emojic
deleted file mode 100644
index 491d7b734..000000000
--- a/contents/bubble_sort/code/emojicode/bubble_sort.emojic
+++ /dev/null
@@ -1,31 +0,0 @@
-π π₯ π
- π βοΈ π numbers π¨ππ―π π
- π numbersβοΈ β‘οΈ count
-
- π i πβ©β© 0 countβοΈ π
- π j πβ©β© 1 countβοΈ π
- βͺοΈ π½ numbers j β 1βοΈ βΆοΈ π½ numbers jβοΈ π
- π½ numbers j β 1βοΈ β‘οΈ temp
- π· numbers j β 1 π½ numbers jβοΈβοΈ
- π· numbers j tempβοΈ
- π
- π
- π
- π
-π
-
-π π
- π¨ 1.7 -3.0 2.5 2.0 -6.0 4.4 50.0 7.0 1.5 -4.3 0.3 π β‘οΈ numbers
-
- π π€unordered:π€βοΈ
- π number numbers π
- π π‘ number 10βοΈβοΈ
- π
-
- πππ₯ numbersβοΈ
-
- π π€ordered:π€βοΈ
- π number numbers π
- π π‘ number 10βοΈβοΈ
- π
-π
diff --git a/contents/bubble_sort/code/fortran/bubble.f90 b/contents/bubble_sort/code/fortran/bubble.f90
deleted file mode 100644
index fb903f0d3..000000000
--- a/contents/bubble_sort/code/fortran/bubble.f90
+++ /dev/null
@@ -1,42 +0,0 @@
-PROGRAM main
-
- IMPLICIT NONE
- REAL(8), DIMENSION(10) :: A
-
- A = (/ 1d0, 3d0, 2d0, 4d0, 5d0, 10d0, 50d0, 7d0, 1.5d0, 0.3d0 /)
-
- WRITE(*,*) 'Input vector'
- WRITE(*,'( F6.2 )') A
- WRITE(*,*) ' '
-
- CALL bubblesort(A)
-
- WRITE(*,*) 'Output vector'
- WRITE(*,'(F6.2)') A
-
-CONTAINS
-
-SUBROUTINE bubblesort(array)
-
- IMPLICIT NONE
- INTEGER :: array_length, i, j, n
- REAL(8) :: tmp
- REAL(8), DIMENSION(:), INTENT(INOUT) :: array
-
- array_length = size(array)
- n = array_length
-
- DO i=1, n
- DO j=1, n-1
- IF ( array(j) > array(j+1) ) THEN
-
- tmp = array(j+1)
- array(j+1) = array(j)
- array(j) = tmp
-
- END IF
- END DO
- END DO
-END SUBROUTINE bubblesort
-
-END PROGRAM main
diff --git a/contents/bubble_sort/code/go/bubbleSort.go b/contents/bubble_sort/code/go/bubbleSort.go
deleted file mode 100644
index df620fe5c..000000000
--- a/contents/bubble_sort/code/go/bubbleSort.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// Submitted by Chinmaya Mahesh (chin123)
-
-package main
-
-import "fmt"
-
-func bubbleSort(array []int) {
- n := len(array)
- for i := 0; i < n-1; i++ {
- swapped := false
- for j := 0; j < n-i-1; j++ {
- if array[j] > array[j+1] {
- array[j], array[j+1] = array[j+1], array[j]
- swapped = true
- }
- }
- if !swapped {
- break
- }
- }
-}
-
-func main() {
- array := [10]int{1, 45, 756, 4569, 56, 3, 8, 5, -10, -4}
- fmt.Println("Unsorted array:", array)
-
- bubbleSort(array[:])
-
- fmt.Println("Sorted array:", array)
-}
diff --git a/contents/bubble_sort/code/haskell/bubbleSort.hs b/contents/bubble_sort/code/haskell/bubbleSort.hs
deleted file mode 100644
index 50e2308a5..000000000
--- a/contents/bubble_sort/code/haskell/bubbleSort.hs
+++ /dev/null
@@ -1,6 +0,0 @@
-bubbleSort :: (Ord a) => [a] -> [a]
-bubbleSort x = (!!length x) $ iterate bubble x
- where bubble (x:y:r)
- | x <= y = x : bubble (y:r)
- | otherwise = y : bubble (x:r)
- bubble x = x
diff --git a/contents/bubble_sort/code/java/Bubble.java b/contents/bubble_sort/code/java/Bubble.java
deleted file mode 100644
index 3ece7c965..000000000
--- a/contents/bubble_sort/code/java/Bubble.java
+++ /dev/null
@@ -1,30 +0,0 @@
-public class Bubble {
- static void bubbleSort(int[] arr) {
- for (int r = arr.length - 1; r > 0; r--) {
- for (int i = 0; i < r; i++) {
- if(arr[i] > arr[i + 1]) {
- int tmp = arr[i];
- arr[i] = arr[i + 1];
- arr[i + 1] = tmp;
- }
- }
- }
- }
-
- public static void main(String[] args) {
- int[] test = new int[]{20, -3, 50, 1, -6, 59};
-
- System.out.println("Unsorted array :");
- for (int i = 0; i < test.length; i++) {
- System.out.print(test[i] + " ");
- }
-
- bubbleSort(test);
-
- System.out.println("\n\nSorted array :");
- for (int i = 0; i < test.length; i++) {
- System.out.print(test[i] + " ");
- }
- System.out.println("");
- }
-}
diff --git a/contents/bubble_sort/code/javascript/bubble.js b/contents/bubble_sort/code/javascript/bubble.js
deleted file mode 100644
index f1f36d971..000000000
--- a/contents/bubble_sort/code/javascript/bubble.js
+++ /dev/null
@@ -1,20 +0,0 @@
-function bubbleSort(arr) {
- let tmp;
- for (let i = 0; i < arr.length; i++) {
- for (let k = 0; k < arr.length - 1; k++) {
- if (arr[k] > arr[k + 1]) {
- tmp = arr[k];
- arr[k] = arr[k + 1];
- arr[k + 1] = tmp;
- }
- }
- }
-}
-
-function main() {
- const testArray = [1, 3, 2, 4, 5, 10, 50, 7, 1.5, 0.3];
- bubbleSort(testArray);
- console.log(testArray);
-}
-
-main();
diff --git a/contents/bubble_sort/code/julia/bubble.jl b/contents/bubble_sort/code/julia/bubble.jl
deleted file mode 100644
index d4c970187..000000000
--- a/contents/bubble_sort/code/julia/bubble.jl
+++ /dev/null
@@ -1,19 +0,0 @@
-function bubble_sort!(a::Vector{Float64})
- n = length(a)
- for i = 1:n
- for j = 1:n-1
- if(a[j] < a[j+1])
- a[j], a[j+1] = a[j+1], a[j]
- end
- end
- end
-end
-
-
-function main()
- a = [1., 3, 2, 4, 5, 10, 50, 7, 1.5, 0.3]
- bubble_sort!(a)
- println(a)
-end
-
-main()
diff --git a/contents/bubble_sort/code/kotlin/BubbleSort.kt b/contents/bubble_sort/code/kotlin/BubbleSort.kt
deleted file mode 100644
index 8cfa611da..000000000
--- a/contents/bubble_sort/code/kotlin/BubbleSort.kt
+++ /dev/null
@@ -1,18 +0,0 @@
-fun bubbleSort(input: MutableList) {
- for (i in (input.size - 1) downTo 0) {
- for (j in 0 until i) {
- if (input[j] > input[j + 1]) {
- input[j] = input[j + 1].also {
- input[j + 1] = input[j]
- }
- }
- }
- }
-}
-
-fun main(args: Array) {
- var list = mutableListOf(4, 2, 9, 20, 11, 30, 1, 0);
- println("Original $list")
- bubbleSort(list)
- println("Sorted $list")
-}
diff --git a/contents/bubble_sort/code/lua/bubble_sort.lua b/contents/bubble_sort/code/lua/bubble_sort.lua
deleted file mode 100644
index 7d0f042aa..000000000
--- a/contents/bubble_sort/code/lua/bubble_sort.lua
+++ /dev/null
@@ -1,16 +0,0 @@
-local function bubble_sort(arr)
- for i = 1,#arr-1 do
- for j = 1,#arr-1 do
- if arr[j] > arr[j+1] then
- arr[j], arr[j+1] = arr[j+1], arr[j]
- end
- end
- end
-end
-
-local arr = {1, 45, 756, 4569, 56, 3, 8, 5, -10, -4}
-print(("Unsorted array: {%s}"):format(table.concat(arr,", ")))
-
-bubble_sort(arr)
-
-print(("Sorted array: {%s}"):format(table.concat(arr,", ")))
diff --git a/contents/bubble_sort/code/matlab/bubblesort.m b/contents/bubble_sort/code/matlab/bubblesort.m
deleted file mode 100644
index 4c7378a48..000000000
--- a/contents/bubble_sort/code/matlab/bubblesort.m
+++ /dev/null
@@ -1,25 +0,0 @@
-function sorted_array = bubblesort(array)
- for i = 1 : length(array)
- for j = 1 : length(array) - i
- if array(j) > array(j+1)
- % swap elements in the list
- temp = array(j);
- array(j) = array(j+1);
- array(j+1) = temp;
- end
- end
- end
- sorted_array = array;
-end
-
-function main()
- array = floor(rand(1, 7) * 100);
- disp('Before Sorting:')
- disp(array)
-
- array = bubble_sort(array);
- disp('After Sorting:')
- disp(array)
-end
-
-main()
diff --git a/contents/bubble_sort/code/nim/bubble_sort.nim b/contents/bubble_sort/code/nim/bubble_sort.nim
deleted file mode 100644
index ad7c58d08..000000000
--- a/contents/bubble_sort/code/nim/bubble_sort.nim
+++ /dev/null
@@ -1,16 +0,0 @@
-proc print_array(a: openArray[int]) =
- for n in 0 .. < len(a):
- echo a[n]
-
-proc bubble_sort(a: var openArray[int]) =
- for i in 0 .. < len(a) - 1:
- for j in 0 .. < len(a) - 1:
- if a[j + 1] < a[j]:
- swap(a[j], a[j + 1])
-
-var x: array[10,int] = [32, 32, 64, 16, 128, 8, 256, 4, 512, 2]
-echo "Unsorted:"
-print_array(x)
-echo "\nSorted:"
-bubble_sort(x)
-print_array(x)
diff --git a/contents/bubble_sort/code/php/bubble_sort.php b/contents/bubble_sort/code/php/bubble_sort.php
deleted file mode 100644
index cb7ea77e9..000000000
--- a/contents/bubble_sort/code/php/bubble_sort.php
+++ /dev/null
@@ -1,25 +0,0 @@
- $arr[$j]) {
- $tmp = $arr[$j - 1];
- $arr[$j - 1] = $arr[$j];
- $arr[$j] = $tmp;
- }
- }
- }
-
- return $arr;
-}
-
-$unsorted = [1, 2, 6, 47, 4, 9, 3, 7, 8, 23, 15];
-$bubble_sorted = bubble_sort($unsorted);
-
-printf('Unsorted: %s', implode(',', $unsorted));
-echo PHP_EOL;
-printf('Sorted: %s', implode(',', $bubble_sorted));
-echo PHP_EOL;
diff --git a/contents/bubble_sort/code/python/bubblesort.py b/contents/bubble_sort/code/python/bubblesort.py
deleted file mode 100644
index 18485a73c..000000000
--- a/contents/bubble_sort/code/python/bubblesort.py
+++ /dev/null
@@ -1,17 +0,0 @@
-import random
-
-
-def bubble_sort(array):
- len_array = len(array)
- for i in range(len_array):
- for j in range(len_array - i - 1):
- if(array[j] > array[j+1]):
- array[j], array[j+1] = array[j+1], array[j] #swap elements in the list
-
-def main():
- random_array = [random.randint(0, 1000) for _ in range(10)]
- print("Before Sorting {}".format(random_array))
- bubble_sort(random_array)
- print("After Sorting {}".format(random_array))
-
-main()
diff --git a/contents/bubble_sort/code/r/bubble_sort.R b/contents/bubble_sort/code/r/bubble_sort.R
deleted file mode 100644
index 6fa232bb1..000000000
--- a/contents/bubble_sort/code/r/bubble_sort.R
+++ /dev/null
@@ -1,20 +0,0 @@
-bubble_sort <- function(arr) {
- for (i in seq_along(arr)) {
- for (j in seq_along(arr[-1])) {
- if (arr[j] > arr[j + 1]) {
- tmp <- arr[j]
- arr[j] <- arr[j + 1]
- arr[j + 1] <- tmp
- }
- }
- }
- return(arr)
-}
-
-x <- c(20, -3, 50, 1, -6, 59)
-print("Before sorting:")
-print(x)
-
-x <- bubble_sort(x)
-print("After sorting:")
-print(x)
diff --git a/contents/bubble_sort/code/racket/bubbleSort.rkt b/contents/bubble_sort/code/racket/bubbleSort.rkt
deleted file mode 100644
index 320cddc78..000000000
--- a/contents/bubble_sort/code/racket/bubbleSort.rkt
+++ /dev/null
@@ -1,21 +0,0 @@
-#lang racket
-
-(provide bubbleSort)
-
-
-(define bubbleSort
- (case-lambda [(l) (bubbleSort l (length l))]
- [(l n) (if (= n 1)
- l
- (bubbleSort (pass l 0 n) (- n 1)))]))
-
-; a single pass, if this is the nth pass, then we know that the (n - 1) last elements are already sorted
-(define (pass l counter n)
- (let ([x (first l)]
- [y (second l)]
- [r (drop l 2)])
- (cond [(= (- n counter) 2) (cons (min x y) (cons (max x y) r))]
- [(cons (min x y) (pass (cons (max x y) r) (+ counter 1) n))])))
-
-
-((lambda (x) (display (bubbleSort x))) (read))
diff --git a/contents/bubble_sort/code/ruby/bubble.rb b/contents/bubble_sort/code/ruby/bubble.rb
deleted file mode 100644
index 0511d06cc..000000000
--- a/contents/bubble_sort/code/ruby/bubble.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/bin/env ruby
-
-def bubble_sort(arr)
- (0..arr.length - 1).each do
- (0..arr.length - 2).each do |k|
- if arr[k] > arr[k + 1]
- arr[k + 1], arr[k] = arr[k], arr[k + 1]
- end
- end
- end
-
- return arr
-end
-
-def main
- range = [200, 79, 69, 45, 32, 5, 15, 88, 620, 125]
- puts "The range before sorting is #{range}"
- range = bubble_sort(range)
- puts "The range after sorting is #{range}"
-end
-
-main()
diff --git a/contents/bubble_sort/code/rust/bubble_sort.rs b/contents/bubble_sort/code/rust/bubble_sort.rs
deleted file mode 100644
index 104e43783..000000000
--- a/contents/bubble_sort/code/rust/bubble_sort.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-extern crate rand; // External crate that provides random number generation tools
-
-use rand::distributions::Uniform; // Used for a uniform distribution
-use rand::{thread_rng, Rng}; // Used for random number generation
-
-fn bubble_sort(a: &mut [u32]) {
- let n = a.len();
-
- for _ in 0..n {
- for j in 1..n {
- if a[j - 1] > a[j] {
- a.swap(j, j - 1);
- }
- }
- }
-}
-
-fn main() {
- let mut rng = thread_rng(); // Create random number generator
- let num_range = Uniform::new_inclusive(0, 10000); // Obtain uniform distribution of range [0, 10000]
- let mut rand_vec: Vec = rng.sample_iter(&num_range).take(10).collect();
- // Generates random values over that range, take 10 values from it and collect in vector
-
- println!("Before sorting: {:?}", rand_vec);
- bubble_sort(&mut rand_vec);
- println!("After sorting: {:?}", rand_vec);
-}
diff --git a/contents/bubble_sort/code/scala/bubble_sort.scala b/contents/bubble_sort/code/scala/bubble_sort.scala
deleted file mode 100644
index 534a98eac..000000000
--- a/contents/bubble_sort/code/scala/bubble_sort.scala
+++ /dev/null
@@ -1,22 +0,0 @@
-object BubbleSort {
-
- def bubbleDown(list: List[Int]): List[Int] =
- list match {
- case a :: b :: tail if a < b => b :: bubbleDown(a :: tail)
- case a :: b :: tail => a :: bubbleDown(b :: tail)
- case _ => list
- }
-
- def bubbleSort(list: List[Int]): List[Int] =
- bubbleDown(list) match {
- case unsorted :+ smallest => smallest :: bubbleDown(unsorted)
- case _ => list
- }
-
- def main(args: Array[String]): Unit = {
- val unsorted = List(9, 2, 0, 5, 3, 8, 1, 9, 4, 0, 7, 0, 9, 9, 0)
-
- println("Unsorted list is " + unsorted)
- println(" Sorted list is " + bubbleSort(unsorted))
- }
-}
diff --git a/contents/bubble_sort/code/scratch/bubble_sort.svg b/contents/bubble_sort/code/scratch/bubble_sort.svg
deleted file mode 100644
index 333bf828f..000000000
--- a/contents/bubble_sort/code/scratch/bubble_sort.svg
+++ /dev/null
@@ -1,116 +0,0 @@
-
-
-define BubbleSort set i to 1 set j to 1 repeat length of a repeat length of a - 1 If item j + 1 of a < item j of a then set tmp to item j of a replace item j of a with item j + 1 of a replace item j + 1 of a with tmp change j by 1 set j to 1 change i by 1
\ No newline at end of file
diff --git a/contents/bubble_sort/code/scratch/bubble_sort.txt b/contents/bubble_sort/code/scratch/bubble_sort.txt
deleted file mode 100644
index 00c4f286b..000000000
--- a/contents/bubble_sort/code/scratch/bubble_sort.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-define BubbleSort
-set [i v] to (1)
-set [j v] to (1)
-repeat (length of [a v])
- repeat ((length of [a v]) - (1))
- If <(item ((j)+(1)) of [a v]) < (item (j) of [a v])> then
- set [tmp v] to (item (j) of [a v])
- replace item (j) of [a v] with (item ((j)+(1)) of [a v]
- replace item ((j)+(1)) of [a v] with (tmp)
- end
- change [j v] by (1)
- end
-set [j v] to (1)
-change [i v] by (1)
-end
diff --git a/contents/bubble_sort/code/smalltalk/bubble.st b/contents/bubble_sort/code/smalltalk/bubble.st
deleted file mode 100644
index 70dbaca1c..000000000
--- a/contents/bubble_sort/code/smalltalk/bubble.st
+++ /dev/null
@@ -1,18 +0,0 @@
-"Add this method to the SequenceableCollection class in the browser:"
-SequenceableCollection>>bubbleSort
- "Bubble sort for a collection."
- | len swapper thisElem nextElem |
- len := self size.
- 1 to: len - 1 do: [ :iteration |
- 1 to: len - 1 do: [ :index |
- thisElem := self at: index.
- nextElem := self at: index + 1.
- (thisElem > nextElem) ifTrue: [
- self at: thisIndex + 1 put: thisElem.
- self at: thisIndex put: nextElem.
- ]
- ]
- ]
-
-"Then run this anywhere in your code: "
-#(4 3 2 1 6 5) bubbleSort "outputs: #(1 2 3 4 5 6)"
diff --git a/contents/bubble_sort/code/swift/bubblesort.swift b/contents/bubble_sort/code/swift/bubblesort.swift
deleted file mode 100644
index 3552f2125..000000000
--- a/contents/bubble_sort/code/swift/bubblesort.swift
+++ /dev/null
@@ -1,20 +0,0 @@
-func bubbleSort(sortArray: inout [Int]) -> [Int] {
- for i in (1.. sortArray[j+1] {
- let temp = sortArray[j]
- sortArray[j] = sortArray[j + 1]
- sortArray[j + 1] = temp
- }
- }
- }
-
- return sortArray
-}
-
-func main() {
- var testArray = [4,5,123,759,-132,8940,24,34,-5]
- print(bubbleSort(sortArray: &testArray))
-}
-
-main()
diff --git a/contents/bubble_sort/code/ti83basic/BUBLSORT.txt b/contents/bubble_sort/code/ti83basic/BUBLSORT.txt
deleted file mode 100644
index 6a735472e..000000000
--- a/contents/bubble_sort/code/ti83basic/BUBLSORT.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-:"SUBMITTED BY GIBUS WEARING BRONY"
-:"L IS LENGTH OF LIST"
-:dim(L1)βL
-:For(A,1,L)
-:For(X,1,L-1)
-:If L1(X)>L1(X+1)
-:Then
-:L1(X)βY
-:L1(X+1)βL1(X)
-:YβL1(X+1)
-:End
-:End
-:End
-:Disp L1
diff --git a/contents/bubble_sort/code/v/bubble_sort.v b/contents/bubble_sort/code/v/bubble_sort.v
deleted file mode 100644
index d8fddb59b..000000000
--- a/contents/bubble_sort/code/v/bubble_sort.v
+++ /dev/null
@@ -1,20 +0,0 @@
-fn bubblesort(arr mut []int) {
- for i := 0; i < arr.len-1; i++ {
- for j := 0; j < arr.len-i-1; j++ {
- if arr[j] > arr[j+1] {
- tmp := arr[j]
- arr[j] = arr[j+1]
- arr[j+1] = tmp
- }
- }
- }
-}
-
-fn main() {
- mut arr := [1, 45, 756, 4569, 56, 3, 8, 5, -10, -4]
- println('Array unsorted:')
- println(arr)
- bubblesort(mut arr)
- println('Array sorted:')
- println(arr)
-}
\ No newline at end of file
diff --git a/contents/sorting_and_searching/sorting_and_searching.md b/contents/sorting_and_searching/sorting_and_searching.md
deleted file mode 100644
index d6f9aab8b..000000000
--- a/contents/sorting_and_searching/sorting_and_searching.md
+++ /dev/null
@@ -1,32 +0,0 @@
-# Sorting and Searching
-When it comes to algorithms that programmers know and love, the stereotypical examples are often algorithms that either sort or search through a given container of elements.
-For the most part, sorting and searching methods are two sides to the same coin and are almost always described together due to their similarities.
-To be honest, they are also good thought exercises for new programmers.
-It's often inspiring to hear how individuals who have no programming experience go about solving the problem, because there are so many ways to do it!
-
-All said, sorting and searching are fundamental to numerous algorithms and really show how computer science has evolved with time to lower the complexity of problems that seem straightforward at first-glance.
-
-As the Archive evolves, more and more sorting algorithms will be added, so feel free to let me know your favorite algorithm and I'll do my best to put it in!
-Right now, there are only a few (straightforward) examples, so expect some more complicated algorithms in the future!
-
-
-
-
-## License
-
-##### Code Examples
-
-The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)).
-
-##### Text
-
-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).
-
-[
](https://creativecommons.org/licenses/by-sa/4.0/)
-
-##### Pull Requests
-
-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:
-- none