From 619b8949e328e65751815fdfc03530610f8179b4 Mon Sep 17 00:00:00 2001 From: aphitorite Date: Wed, 10 Jun 2020 12:23:54 -0600 Subject: [PATCH 1/7] new --- src/sorts/IterativeCombSort.java | 72 ++++++++++++++++++++++++++++ src/sorts/SmartBogoSort.java | 80 ++++++++++++++++++++++++++++++++ 2 files changed, 152 insertions(+) create mode 100644 src/sorts/IterativeCombSort.java create mode 100644 src/sorts/SmartBogoSort.java diff --git a/src/sorts/IterativeCombSort.java b/src/sorts/IterativeCombSort.java new file mode 100644 index 00000000..da297c69 --- /dev/null +++ b/src/sorts/IterativeCombSort.java @@ -0,0 +1,72 @@ +package sorts; + +import templates.Sort; +import utils.Delays; +import utils.Highlights; +import utils.Reads; +import utils.Writes; + +/* + * +The MIT License (MIT) + +Copyright (c) 2012 Daniel Imms, http://www.growingwiththeweb.com + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +//Implementation by @aphitorite +final public class IterativeCombSort extends Sort { + public IterativeCombSort(Delays delayOps, Highlights markOps, Reads readOps, Writes writeOps) { + super(delayOps, markOps, readOps, writeOps); + + this.setSortPromptID("Iterative Comb"); + this.setRunAllID("Iterative Comb Sort"); + this.setReportSortID("Iterative Combsort"); + this.setCategory("Exchange Sorts"); + this.isComparisonBased(true); + this.isBucketSort(false); + this.isRadixSort(false); + this.isUnreasonablySlow(false); + this.setUnreasonableLimit(0); + this.isBogoSort(false); + + } + + @Override + public void runSort(int[] array, int length, int bucketCount) { + int pow2 = (int)(Math.log(length-1)/Math.log(2)); + + for(int k = pow2; k >= 0; k--) { + int pow3 = (int)((Math.log(length) - k*Math.log(2))/Math.log(3)); + + for(int j = pow3; j >= 0; j--) { + int gap = (int)(Math.pow(2, k)*Math.pow(3, j)); + + for(int i = 0; i+gap < length; i++) { + Highlights.markArray(1, i); + Highlights.markArray(2, i+gap); + Delays.sleep(0.25); + if(Reads.compare(array[i],array[i+gap])==1) + Writes.swap(array, i, i+gap, 0.75, true, false); + } + } + } + } +} \ No newline at end of file diff --git a/src/sorts/SmartBogoSort.java b/src/sorts/SmartBogoSort.java new file mode 100644 index 00000000..f6dd1306 --- /dev/null +++ b/src/sorts/SmartBogoSort.java @@ -0,0 +1,80 @@ +package sorts; + +import templates.BogoSorting; +import utils.Delays; +import utils.Highlights; +import utils.Reads; +import utils.Writes; + +/* + * +MIT License + +Copyright (c) 2019 w0rthy + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + * + */ + +//Implementation by @aphitorite +final public class SmartBogoSort extends BogoSorting { + public SmartBogoSort(Delays delayOps, Highlights markOps, Reads readOps, Writes writeOps) { + super(delayOps, markOps, readOps, writeOps); + + this.setSortPromptID("Smart Bogo"); + this.setRunAllID("Deterministic Bogo (Permutation) Sort"); + this.setReportSortID("Permutationsort"); + this.setCategory("Distributive Sorts"); + this.isComparisonBased(false); + this.isBucketSort(false); + this.isRadixSort(false); + this.isUnreasonablySlow(true); + this.setUnreasonableLimit(16); + this.isBogoSort(true); + } + + @Override + public void runSort(int[] array, int currentLen, int bucketCount) { + //Counts the permutations with n digits (max value only needs to be n!) + int[] pNum = new int[currentLen]; + int i, j; + + while(!this.bogoIsSorted(array, currentLen)) { + //Increments the pNum count through a factorial counting system + for(i = 1; pNum[i] == i; i++) + Writes.write(pNum, i, 0, 0, false, true); + Writes.write(pNum, i, pNum[i]+1, 0, false, true); + + //Makes the minimum amount of swaps back for the next step + for(j = 1; j <= i; j++) { + if(pNum[j] != 1) { + if(pNum[j] == 0) + Writes.swap(array, j, j-1, 0, false, false); + else + Writes.swap(array, j, pNum[j]-2, 0, false, false); + } + } + + //Makes the minimum amount of swaps to generate current permutation + for(j = i; j > 0; j--) + if(pNum[j] != 0) + Writes.swap(array, j, pNum[j]-1, 0, false, false); + } + } +} \ No newline at end of file From e3fa9db789d6b1c87935217ca3d53ffe39814ec6 Mon Sep 17 00:00:00 2001 From: aphitorite Date: Sat, 13 Jun 2020 10:11:52 -0600 Subject: [PATCH 2/7] update license --- src/sorts/IterativeCombSort.java | 3 +-- src/sorts/SmartBogoSort.java | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/sorts/IterativeCombSort.java b/src/sorts/IterativeCombSort.java index da297c69..4842d18d 100644 --- a/src/sorts/IterativeCombSort.java +++ b/src/sorts/IterativeCombSort.java @@ -10,7 +10,7 @@ * The MIT License (MIT) -Copyright (c) 2012 Daniel Imms, http://www.growingwiththeweb.com +Copyright (c) 2020 aphitorite Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in @@ -31,7 +31,6 @@ this software and associated documentation files (the "Software"), to deal in * */ -//Implementation by @aphitorite final public class IterativeCombSort extends Sort { public IterativeCombSort(Delays delayOps, Highlights markOps, Reads readOps, Writes writeOps) { super(delayOps, markOps, readOps, writeOps); diff --git a/src/sorts/SmartBogoSort.java b/src/sorts/SmartBogoSort.java index f6dd1306..374ccb94 100644 --- a/src/sorts/SmartBogoSort.java +++ b/src/sorts/SmartBogoSort.java @@ -10,7 +10,7 @@ * MIT License -Copyright (c) 2019 w0rthy +Copyright (c) 2020 aphitorite Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -32,7 +32,6 @@ of this software and associated documentation files (the "Software"), to deal * */ -//Implementation by @aphitorite final public class SmartBogoSort extends BogoSorting { public SmartBogoSort(Delays delayOps, Highlights markOps, Reads readOps, Writes writeOps) { super(delayOps, markOps, readOps, writeOps); From 6a1ccad5efa35744d7ec85a93b9857c01b58019e Mon Sep 17 00:00:00 2001 From: aphitorite Date: Sun, 6 Sep 2020 22:18:52 -0600 Subject: [PATCH 3/7] Update SmartBogoSort.java --- src/sorts/SmartBogoSort.java | 54 +++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/src/sorts/SmartBogoSort.java b/src/sorts/SmartBogoSort.java index 374ccb94..fdd518de 100644 --- a/src/sorts/SmartBogoSort.java +++ b/src/sorts/SmartBogoSort.java @@ -37,43 +37,47 @@ public SmartBogoSort(Delays delayOps, Highlights markOps, Reads readOps, Writes super(delayOps, markOps, readOps, writeOps); this.setSortPromptID("Smart Bogo"); - this.setRunAllID("Deterministic Bogo (Permutation) Sort"); + this.setRunAllID("Permutation Sort"); this.setReportSortID("Permutationsort"); this.setCategory("Distributive Sorts"); this.isComparisonBased(false); this.isBucketSort(false); this.isRadixSort(false); this.isUnreasonablySlow(true); - this.setUnreasonableLimit(16); + this.setUnreasonableLimit(12); this.isBogoSort(true); } - + + //deterministic bogo sort to run in guaranteed O(n*n!) worst case + //heap's algorithm from wikipedia @Override public void runSort(int[] array, int currentLen, int bucketCount) { - //Counts the permutations with n digits (max value only needs to be n!) - int[] pNum = new int[currentLen]; - int i, j; + //c is an encoding of the stack state. c[k] encodes the for-loop counter for when generate(k+1, A) is called + int[] c = new int[currentLen]; + + if(this.bogoIsSorted(array, currentLen)) return; - while(!this.bogoIsSorted(array, currentLen)) { - //Increments the pNum count through a factorial counting system - for(i = 1; pNum[i] == i; i++) - Writes.write(pNum, i, 0, 0, false, true); - Writes.write(pNum, i, pNum[i]+1, 0, false, true); - - //Makes the minimum amount of swaps back for the next step - for(j = 1; j <= i; j++) { - if(pNum[j] != 1) { - if(pNum[j] == 0) - Writes.swap(array, j, j-1, 0, false, false); - else - Writes.swap(array, j, pNum[j]-2, 0, false, false); + //i acts similarly to the stack pointer + int i = 0; + while(i < currentLen) { + if(c[i] < i) { + if(i%2 == 0) { + Writes.swap(array, 0, i, 0, false, false); } + else { + Writes.swap(array, c[i], i, 0, false, false); + } + if(this.bogoIsSorted(array, currentLen)) return; + //Swap has occurred ending the for-loop. Simulate the increment of the for-loop counter + Writes.write(c, i, c[i]+1, 0, false, true); + //Simulate recursive call reaching the base case by bringing the pointer to the base case analog in the array + i = 0; + } + else { + //Calling generate(i+1, A) has ended as the for-loop terminated. Reset the state and simulate popping the stack by incrementing the pointer. + Writes.write(c, i, 0, 0, false, true); + i++; } - - //Makes the minimum amount of swaps to generate current permutation - for(j = i; j > 0; j--) - if(pNum[j] != 0) - Writes.swap(array, j, pNum[j]-1, 0, false, false); - } + } } } \ No newline at end of file From f861ea0a613161219c8a4eceb77db0dc44e984b3 Mon Sep 17 00:00:00 2001 From: aphitorite Date: Mon, 7 Sep 2020 09:45:27 -0600 Subject: [PATCH 4/7] Update again --- src/sorts/SmartBogoSort.java | 77 +++++++++++++++++------------------- 1 file changed, 37 insertions(+), 40 deletions(-) diff --git a/src/sorts/SmartBogoSort.java b/src/sorts/SmartBogoSort.java index fdd518de..ee953c6f 100644 --- a/src/sorts/SmartBogoSort.java +++ b/src/sorts/SmartBogoSort.java @@ -6,22 +6,16 @@ import utils.Reads; import utils.Writes; -/* - * -MIT License - -Copyright (c) 2020 aphitorite - +/* MIT License +Copyright (c) 2020 Walker Gray Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -29,16 +23,17 @@ of this software and associated documentation files (the "Software"), to deal LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ +*/ final public class SmartBogoSort extends BogoSorting { + + private int length; + public SmartBogoSort(Delays delayOps, Highlights markOps, Reads readOps, Writes writeOps) { super(delayOps, markOps, readOps, writeOps); - - this.setSortPromptID("Smart Bogo"); + this.setSortPromptID("Permutation"); this.setRunAllID("Permutation Sort"); - this.setReportSortID("Permutationsort"); + this.setReportSortID("Permutation Sort"); this.setCategory("Distributive Sorts"); this.isComparisonBased(false); this.isBucketSort(false); @@ -47,37 +42,39 @@ public SmartBogoSort(Delays delayOps, Highlights markOps, Reads readOps, Writes this.setUnreasonableLimit(12); this.isBogoSort(true); } - - //deterministic bogo sort to run in guaranteed O(n*n!) worst case - //heap's algorithm from wikipedia + @Override public void runSort(int[] array, int currentLen, int bucketCount) { - //c is an encoding of the stack state. c[k] encodes the for-loop counter for when generate(k+1, A) is called - int[] c = new int[currentLen]; + length = currentLen; + permutationSort(array, 0, currentLen-1); + } - if(this.bogoIsSorted(array, currentLen)) return; - - //i acts similarly to the stack pointer - int i = 0; - while(i < currentLen) { - if(c[i] < i) { - if(i%2 == 0) { - Writes.swap(array, 0, i, 0, false, false); - } - else { - Writes.swap(array, c[i], i, 0, false, false); - } - if(this.bogoIsSorted(array, currentLen)) return; - //Swap has occurred ending the for-loop. Simulate the increment of the for-loop counter - Writes.write(c, i, c[i]+1, 0, false, true); - //Simulate recursive call reaching the base case by bringing the pointer to the base case analog in the array - i = 0; - } - else { - //Calling generate(i+1, A) has ended as the for-loop terminated. Reset the state and simulate popping the stack by incrementing the pointer. - Writes.write(c, i, 0, 0, false, true); - i++; + private boolean permutationSort(int[] array, int min, int max) + { + if(max != length-1) throw new RuntimeException(); + boolean sorted = false; + int i; + for(i = max; i > min; i--) + { + if(max > min+1) + { + sorted = permutationSort(array, min+1, max); //permutation = recurrence relation + } + if(sorted || this.bogoIsSorted(array, max+1)) + { + return sorted; + } + if((max+1-min)%2 == 0) + { + Writes.swap(array, min, i, 0, true, false); + } else { + Writes.swap(array, min, max, 0, true, false); } } + if(max > min+1) + { + return permutationSort(array, min+1, max); //permutation = recurrence relation + } + return false; } } \ No newline at end of file From 99639c5e944a8ce751e16cfab82966d4fcad24e3 Mon Sep 17 00:00:00 2001 From: aphitorite Date: Mon, 7 Sep 2020 09:46:50 -0600 Subject: [PATCH 5/7] rename --- src/sorts/SmartBogoSort.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sorts/SmartBogoSort.java b/src/sorts/SmartBogoSort.java index ee953c6f..1b400d69 100644 --- a/src/sorts/SmartBogoSort.java +++ b/src/sorts/SmartBogoSort.java @@ -31,7 +31,7 @@ final public class SmartBogoSort extends BogoSorting { public SmartBogoSort(Delays delayOps, Highlights markOps, Reads readOps, Writes writeOps) { super(delayOps, markOps, readOps, writeOps); - this.setSortPromptID("Permutation"); + this.setSortPromptID("Smart Bogo"); this.setRunAllID("Permutation Sort"); this.setReportSortID("Permutation Sort"); this.setCategory("Distributive Sorts"); From bd8075e54cb5d6b8229a29d22a00751d4f793855 Mon Sep 17 00:00:00 2001 From: wakfi <55608093+wakfi@users.noreply.github.com> Date: Mon, 7 Sep 2020 15:06:47 -0700 Subject: [PATCH 6/7] Change max from parameter to variable --- src/sorts/SmartBogoSort.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/sorts/SmartBogoSort.java b/src/sorts/SmartBogoSort.java index 1b400d69..c2cca708 100644 --- a/src/sorts/SmartBogoSort.java +++ b/src/sorts/SmartBogoSort.java @@ -27,7 +27,7 @@ of this software and associated documentation files (the "Software"), to deal final public class SmartBogoSort extends BogoSorting { - private int length; + private int max; public SmartBogoSort(Delays delayOps, Highlights markOps, Reads readOps, Writes writeOps) { super(delayOps, markOps, readOps, writeOps); @@ -45,24 +45,23 @@ public SmartBogoSort(Delays delayOps, Highlights markOps, Reads readOps, Writes @Override public void runSort(int[] array, int currentLen, int bucketCount) { - length = currentLen; - permutationSort(array, 0, currentLen-1); + max = currentLen - 1; + permutationSort(array, 0); } - private boolean permutationSort(int[] array, int min, int max) + private boolean permutationSort(int[] array, int min) { - if(max != length-1) throw new RuntimeException(); boolean sorted = false; int i; for(i = max; i > min; i--) { if(max > min+1) { - sorted = permutationSort(array, min+1, max); //permutation = recurrence relation + sorted = permutationSort(array, min+1); //permutation = recurrence relation } if(sorted || this.bogoIsSorted(array, max+1)) { - return sorted; + return true; } if((max+1-min)%2 == 0) { @@ -73,7 +72,7 @@ private boolean permutationSort(int[] array, int min, int max) } if(max > min+1) { - return permutationSort(array, min+1, max); //permutation = recurrence relation + return permutationSort(array, min+1); //permutation = recurrence relation } return false; } From 5d2233105fce4605a7e3eddaa35568d95fa5b743 Mon Sep 17 00:00:00 2001 From: wakfi <55608093+wakfi@users.noreply.github.com> Date: Mon, 7 Sep 2020 19:59:17 -0700 Subject: [PATCH 7/7] Add IterativeComb and SmartBogo to categories for RunAllSorts Length 11 on SmartBogoSort gives a good visual without being boringly long, which would be useful for video makers. It breaks the pattern of powers of 2 however, but there are currently no Delays built into the sort that would allow this to be manipulated using a speed modification instead. I put 8 for the length even though it's instant because 16 takes an obscene amount of time --- src/sorts/SmartBogoSort.java | 2 +- src/threads/RunExchangeSorts.java | 4 ++++ src/threads/RunImpracticalSorts.java | 8 ++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/sorts/SmartBogoSort.java b/src/sorts/SmartBogoSort.java index c2cca708..cb6412f8 100644 --- a/src/sorts/SmartBogoSort.java +++ b/src/sorts/SmartBogoSort.java @@ -34,7 +34,7 @@ public SmartBogoSort(Delays delayOps, Highlights markOps, Reads readOps, Writes this.setSortPromptID("Smart Bogo"); this.setRunAllID("Permutation Sort"); this.setReportSortID("Permutation Sort"); - this.setCategory("Distributive Sorts"); + this.setCategory("Impractical Sorts"); this.isComparisonBased(false); this.isBucketSort(false); this.isRadixSort(false); diff --git a/src/threads/RunExchangeSorts.java b/src/threads/RunExchangeSorts.java index 5926f30c..242ffd64 100644 --- a/src/threads/RunExchangeSorts.java +++ b/src/threads/RunExchangeSorts.java @@ -8,6 +8,7 @@ import sorts.CombSort; import sorts.DualPivotQuickSort; import sorts.GnomeSort; +import sorts.IterativeCombSort; import sorts.LLQuickSort; import sorts.LRQuickSort; import sorts.OddEvenSort; @@ -61,6 +62,7 @@ final public class RunExchangeSorts extends MultipleSortThread { private Sort LRQuickSort; private Sort DualPivotQuickSort; private Sort StableQuickSort; + private Sort IterativeCombSort; public RunExchangeSorts(ArrayVisualizer ArrayVisualizer) { super(ArrayVisualizer); @@ -81,6 +83,7 @@ public RunExchangeSorts(ArrayVisualizer ArrayVisualizer) { LRQuickSort = new LRQuickSort(Delays, Highlights, Reads, Writes); DualPivotQuickSort = new DualPivotQuickSort(Delays, Highlights, Reads, Writes); StableQuickSort = new StableQuickSort(Delays, Highlights, Reads, Writes); + IterativeCombSort = new IterativeCombSort(Delays, Highlights, Reads, Writes); } @Override @@ -94,6 +97,7 @@ protected synchronized void executeSortList(int[] array) throws Exception { RunExchangeSorts.this.runIndividualSort(SmartGnomeSort, 0, array, 128, 0.025); RunExchangeSorts.this.runIndividualSort(BinaryGnomeSort, 0, array, 128, 0.025); RunExchangeSorts.this.runIndividualSort(CombSort, 0, array, 1024, 1); + RunExchangeSorts.this.runIndividualSort(IterativeCombSort, 0, array, 1024, 1); RunExchangeSorts.this.runIndividualSort(CircleSort, 0, array, 1024, 1); RunExchangeSorts.this.runIndividualSort(LLQuickSort, 0, array, 2048, ArrayManager.getShuffle() == Shuffles.RANDOM ? 1.5 : 65); RunExchangeSorts.this.runIndividualSort(LRQuickSort, 0, array, 2048, 1); diff --git a/src/threads/RunImpracticalSorts.java b/src/threads/RunImpracticalSorts.java index 69da1159..552dbca5 100644 --- a/src/threads/RunImpracticalSorts.java +++ b/src/threads/RunImpracticalSorts.java @@ -9,6 +9,7 @@ import sorts.LessBogoSort; import sorts.SillySort; import sorts.SlowSort; +import sorts.SmartBogoSort; import sorts.StoogeSort; import templates.JErrorPane; import templates.MultipleSortThread; @@ -49,13 +50,14 @@ final public class RunImpracticalSorts extends MultipleSortThread { private Sort BubbleBogoSort; private Sort LessBogoSort; private Sort CocktailBogoSort; + private Sort SmartBogoSort; private Sort BogoSort; - + public RunImpracticalSorts(ArrayVisualizer ArrayVisualizer) { super(ArrayVisualizer); this.sortCount = 9; this.categoryCount = this.sortCount; - + BadSort = new BadSort(Delays, Highlights, Reads, Writes); StoogeSort = new StoogeSort(Delays, Highlights, Reads, Writes); SillySort = new SillySort(Delays, Highlights, Reads, Writes); @@ -64,6 +66,7 @@ public RunImpracticalSorts(ArrayVisualizer ArrayVisualizer) { BubbleBogoSort = new BubbleBogoSort(Delays, Highlights, Reads, Writes); LessBogoSort = new LessBogoSort(Delays, Highlights, Reads, Writes); CocktailBogoSort = new CocktailBogoSort(Delays, Highlights, Reads, Writes); + SmartBogoSort = new SmartBogoSort(Delays, Highlights, Reads, Writes); BogoSort = new BogoSort(Delays, Highlights, Reads, Writes); } @@ -78,6 +81,7 @@ protected synchronized void executeSortList(int[] array) throws Exception { RunImpracticalSorts.this.runIndividualSort(BubbleBogoSort, 0, array, 32, 0.01); RunImpracticalSorts.this.runIndividualSort(LessBogoSort, 0, array, 16, 0.0025); RunImpracticalSorts.this.runIndividualSort(CocktailBogoSort, 0, array, 16, 0.0025); + RunImpracticalSorts.this.runIndividualSort(SmartBogoSort, 0, array, 8, 1); RunImpracticalSorts.this.runIndividualSort(BogoSort, 0, array, 8, 1); Sounds.toggleSofterSounds(false); }