QuickSortDaniel entfernt (kompiliert nicht)
This commit is contained in:
@@ -57,7 +57,6 @@
|
|||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="src\QuickSortDaniel.cs" />
|
|
||||||
<Compile Include="src\Receiver.cs" />
|
<Compile Include="src\Receiver.cs" />
|
||||||
<Compile Include="src\Sender.cs" />
|
<Compile Include="src\Sender.cs" />
|
||||||
<Compile Include="src\Dragon.cs" />
|
<Compile Include="src\Dragon.cs" />
|
||||||
|
|||||||
@@ -1,67 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace WorldOfPeacecraft
|
|
||||||
{
|
|
||||||
class QuickSortDaniel<T>
|
|
||||||
{
|
|
||||||
private IList<T> SortFiles;
|
|
||||||
public QuickSortDaniel(IList<T> SortFiles)
|
|
||||||
{
|
|
||||||
this.SortFiles = SortFiles;
|
|
||||||
doSort(0, SortFiles.Count-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void doSort(int start, int end)
|
|
||||||
{
|
|
||||||
if (start != end)
|
|
||||||
{
|
|
||||||
|
|
||||||
int size = SortFiles.Count;
|
|
||||||
T pivot;
|
|
||||||
T comparer;
|
|
||||||
int pivotpos = start;
|
|
||||||
int comppos = end;
|
|
||||||
|
|
||||||
pivot = SortFiles[pivotpos];
|
|
||||||
comparer = SortFiles[comppos];
|
|
||||||
|
|
||||||
while (pivotpos != comppos)
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if (comppos > pivotpos)
|
|
||||||
{
|
|
||||||
comppos = comppos - 1;
|
|
||||||
comparer = SortFiles[comppos];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
comppos = comppos + 1;
|
|
||||||
comparer = SortFiles[comppos];
|
|
||||||
}
|
|
||||||
} while (pivot < comparer);
|
|
||||||
|
|
||||||
int tmp = comppos;
|
|
||||||
SortFiles[comppos] = pivot;
|
|
||||||
SortFiles[pivotpos] = comparer;
|
|
||||||
pivotpos = comppos;
|
|
||||||
comppos = tmp;
|
|
||||||
}
|
|
||||||
doSort(start, pivotpos-1);
|
|
||||||
doSort(pivotpos+1, end);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private IList<T> getSortedList()
|
|
||||||
{
|
|
||||||
return SortFiles;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user