Udemy: Master Coding Interview - Bubble Sort - #16

Run Settings
LanguageC#
Language Version
Run Command
using System; class MainClass { static void Main() { int[] numbers = {99, 44, 6, 2, 1, 5, 63, 87, 283, 4, 0}; Console.WriteLine(ToString(numbers)); BubbleSort(numbers); Console.WriteLine(ToString(numbers)); } public static void BubbleSort(int[] array) { for (int i = 0; i < array.Length; i++) { for (int j = 0; j < array.Length - 1 - i; j++) { if (array[j] > array[j+1]) { int temp = array[j+1]; array[j+1] = array[j]; array[j] = temp; } } } } public static string ToString(int[] array) { string s = "{"; for (int i = 0; i < array.Length; i++) { if (i > 0) { s += ", "; } s += array[i]; } s += "}"; return s; } }
Editor Settings
Theme
Key bindings
Full width
Lines