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
count occurances
DotnetQ6
Ternary Operator
a.i. neural framework / J.A.R.V.I.S. / Just A Rather Very Intelligent System
Sort the chars through LINQ
Lambda Expressions Are Cool
Convert string to unicode representation
הארות אופן שימוש
23
asxasxd