Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
22
Task/JortSort/C-sharp/jortsort.cs
Normal file
22
Task/JortSort/C-sharp/jortsort.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
|
||||
class Program
|
||||
{
|
||||
public static bool JortSort<T>(T[] array) where T : IComparable, IEquatable<T>
|
||||
{
|
||||
// sort the array
|
||||
T[] originalArray = (T[]) array.Clone();
|
||||
Array.Sort(array);
|
||||
|
||||
// compare to see if it was originally sorted
|
||||
for (var i = 0; i < originalArray.Length; i++)
|
||||
{
|
||||
if (!Equals(originalArray[i], array[i]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue