Describe the bug
Just found a trivial issue of BubbleSorter:
for (int index = 0; index < collection.Count - 1; index++)
It would be better if use collection.Count - i -1 here because after each passthrough we can confirm that the value we've bubbled up to the right is in its correct position.
Also I didn't find the unit test for it.
Actually this fix doesn't change the time complexity at all so just my two cents.
Describe the bug Just found a trivial issue of BubbleSorter:
It would be better if use
collection.Count - i -1
here because after each passthrough we can confirm that the value we've bubbled up to the right is in its correct position.Also I didn't find the unit test for it.
Actually this fix doesn't change the time complexity at all so just my two cents.
I've made a PR to fix it. Thanks.