Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Selection sort
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
//Computer selection sort using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { int[] ar={5,3,7,2,9,1,0,4,8,6}; int n=ar.Length; for(int x=0; x<n; x++) { int min_index=x; for(int y=x; y<n; y++) { if(ar[min_index]>ar[y]) { min_index=y; } } int temp=ar[x]; ar[x]=ar[min_index]; ar[min_index]=temp; } Console.WriteLine("Sort array in ascending order by using Selection Sort"); foreach(int i in ar) { Console.Write(i+", "); } } } }
Show compiler warnings
[
+
]
Show input
Compilation time: 0,16 sec, absolute running time: 0,09 sec, cpu time: 0,08 sec, average memory usage: 13 Mb, average nr of threads: 3, absolute service time: 0,3 sec
edit mode
|
history
|
discussion
Sort array in ascending order by using Selection Sort 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,