Simple bubble sort c#

No, your algorithm works but your Write operation is misplaced within the outer loop. int[] arr = { 800, 11, 50, 771, 649, 770, 240, 9 }; int temp = 0; for (int write = 0; write < arr.Length; write++) { for (int sort = 0; sort < arr.Length – 1; sort++) { if (arr[sort] … Read more

What is a bubble sort good for? [closed]

Bubble sort is (provably) the fastest sort available under a very specific circumstance. It originally became well known primarily because it was one of the first algorithms (of any kind) that was rigorously analyzed, and the proof was found that it was optimal under its limited circumstance. Consider a file stored on a tape drive, … Read more

error code: 521