CS
cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Created by XXX
using System;
using System.IO;
using System.Linq;
//using System.Collections.Generic;
namespace Algorithms
{
public static class Algorithms
{
public class Sorting<typ>
{
public typ[] SelectionSort(typ[] arr){
int size = arr.Length, min_ind;
typ temp;
for (int i=0; i<size; i++){
min_ind = i;
for (int j=0; j<size; j++){ int xx = Convert.ToInt32(arr[min_ind]);
int yy = Convert.ToInt32(arr[j]);
if (xx < yy){
min_ind = j;
}
}
temp = arr[min_ind];
arr[min_ind] = arr[i];
arr[i] = temp;
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run