Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Insertion Sort
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { //Your code goes here int[] arr={12,3,32,22,675,23,45,2,54}; for(int i=1;i<arr.Length;i++){ int j=i; while(j>0){ if(arr[j-1]>arr[j]) { int temp=arr[j-1]; arr[j-1]=arr[j]; arr[j]=temp; j--; } else break; } Console.WriteLine("Iteration"+i+":"); Console.WriteLine("[{0}]", string.Join(", ", arr)); } Console.WriteLine("[{0}]", string.Join(", ", arr)); } } }
run
|
edit
|
history
|
help
0
Programa_01_01_Declaracion_de_clases
Hello world test
HelloWorld
Fibonacci series
Knapsack Problem - recursive
abebe
Interface
Upgrade
Celsius to Kelvin / Kelvin to Celsius
MightConst - Runtime Constwrapper Value (C#)