Clear["Global`*"]

Quicksort :

quicksort[liste_]:=Module[{list=liste,swap,teile,qsort},

swap[p1_,p2_]:=Module[{temp},
temp=list[[p1]];
list[[p1]]=list[[p2]];
list[[p2]]=temp;
];

teile[links_,rechts_]:=Module[{aaa,i,j,pivot},
i=links;
j=rechts-1;
pivot=list[[rechts]];

aaa:=(
While[list[[i]]≤pivot&&i<rechts,
i++
];
While[list[[j]]≥pivot&&j>links,
j--
];

If[i<j,
swap[i,j];
];
);

aaa[];
While[i<j,aaa[];];

If[list[[i]]>pivot,
swap[i,rechts];
];

i
];


qsort[links_,rechts_]:=Module[{teiler},
If[links<rechts,
teiler=teile[links,rechts];
qsort[links,teiler-1];
qsort[teiler+1,rechts]];
];

qsort[1,Length[list]];
list
]

Heapsort :

heapsort[liste_]:=Module[{list=liste,swap,blub,macheHeap,sortiere},

swap[p1_,p2_]:=Module[{temp},
temp=list[[p1]];
list[[p1]]=list[[p2]];
list[[p2]]=temp;
];

blub[position_,länge_]:=Module[{kindLinks,kindRechts,kind,pos=position,laenge=länge},
While[pos≤Floor[laenge/2],(
kindLinks=pos*2;
kindRechts=kindLinks+1;

kind=kindLinks;
If[kindRechts≤laenge&&list[[kindRechts]]>list[[kindLinks]],kind=kindRechts];

If[list[[pos]]<list[[kind]],(
swap[pos,kind];
pos=kind;
),
Goto[fertig];
];
)];
Label[fertig];
];

macheHeap[]:=Module[{i},
For[i=Floor[Length[list]/2],i≥1,i--,
blub[i,Length[list]];
]
];

sortiere[]:=Module[{i},
For[i=Length[list],i>1,i--,
swap[i,1];
blub[1,i-1];
];
];

macheHeap[];
sortiere[];
list
]

Bubblesort

bubblesort[liste_]:=Module[{list=liste,body,vertauscht,n,swap},

swap[p1_,p2_]:=Module[{temp},
temp=list[[p1]];
list[[p1]]=list[[p2]];
list[[p2]]=temp;
];

body[]:=Module[{i},
vertauscht=False;
For[i=1,i≤n-1,i++,
If[list[[i]]>list[[i+1]],
swap[i,i+1];
vertauscht=True;
];
];
n--;
];

n=Length[list];
body[];
While[vertauscht&&n≥1,body[]];
list
];

Main :

Module[{laenge,quicksorttime,bubblesorttime,mathematicatime,heapsorttime,x,file},
file=OpenWrite["random.dat"];
For[laenge=100,laenge≤1000,laenge+=100,(
x=RandomInteger[1000000,laenge];
heapsorttime=Timing[heapsort[x]][[1]];
quicksorttime=Timing[quicksort[x]][[1]];
bubblesorttime=Timing[bubblesort[x]][[1]];
mathematicatime=Timing[Sort[x]][[1]];
Print[laenge,"\t",quicksorttime,"\t",heapsorttime,"\t",bubblesorttime,"\t",mathematicatime];
Write[file,OutputForm[{laenge/100,laenge,quicksorttime,heapsorttime,bubblesorttime,mathematicatime}]];
)];
Close[file];
]

$RecursionLimit=Infinity;$IterationLimit=Infinity;

Module[{laenge,quicksorttime,bubblesorttime,mathematicatime,heapsorttime,x,file},
file=OpenWrite["asc.dat"];
For[laenge=100,laenge≤1000,laenge+=100,(
x=Sort[RandomInteger[1000000,laenge]];
heapsorttime=Timing[heapsort[x]][[1]];
quicksorttime=Timing[quicksort[x]][[1]];
bubblesorttime=Timing[bubblesort[x]][[1]];
mathematicatime=Timing[Sort[x]][[1]];
Print[laenge,"\t",quicksorttime,"\t",heapsorttime,"\t",bubblesorttime,"\t",mathematicatime];
Write[file,OutputForm[{laenge/100,laenge,quicksorttime,heapsorttime,bubblesorttime,mathematicatime}]];
)];
Close[file];
]

Module[{laenge,quicksorttime,bubblesorttime,mathematicatime,heapsorttime,x,file},
file=OpenWrite["dsc.dat"];
For[laenge=100,laenge≤1000,laenge+=100,(
x=Sort[RandomInteger[1000000,laenge],(#1>#2)&];
heapsorttime=Timing[heapsort[x]][[1]];
quicksorttime=Timing[quicksort[x]][[1]];
bubblesorttime=Timing[bubblesort[x]][[1]];
mathematicatime=Timing[Sort[x]][[1]];
Print[laenge,"\t",quicksorttime,"\t",heapsorttime,"\t",bubblesorttime,"\t",mathematicatime];
Write[file,OutputForm[{laenge/100,laenge,quicksorttime,heapsorttime,bubblesorttime,mathematicatime}]];
)];
Close[file];
]