diff --git a/Divide and Conquer/Counting Sort/code.js b/Divide and Conquer/Counting Sort/code.js index aea80f8f..4293fade 100644 --- a/Divide and Conquer/Counting Sort/code.js +++ b/Divide and Conquer/Counting Sort/code.js @@ -58,15 +58,17 @@ const array = Randomize.Array1D({ N, value: () => Randomize.Integer({ min: 0, ma const number = array[i]; const count = counts[number]; sortedArray[count - 1] = number; + counts[number]--; // visualize { arrayTracer.select(i); countsTracer.select(number); sortedArrayTracer.patch(count - 1, sortedArray[count - 1]); + countsTracer.patch(number, counts[number]); Tracer.delay(); sortedArrayTracer.depatch(count - 1); + countsTracer.depatch(number); countsTracer.deselect(number); arrayTracer.deselect(i); // } - counts[number]--; } })();
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: