数据结构C语言排序算法大全
i
cludestdiohi
cludestdlibhdefi
eM100voidI
sertio
Sorti
tai
tle
gth插入排序i
tijtempfori1ile
gthitempaiji1whiletempajj0aj1ajjaj1tempvoidBI
sertSorti
tai
tle
gth折半插入排序i
tijmidtempi
tlowhighfori1ile
gthilow0highi1tempaiwhilelowhighmidlowhigh2iftempamidhighmid1elselowmid1forji1jhighjaj1ajahigh1tempvoidChoicei
tai
tle
gth选择排序i
tijtempi
dex
ffori0ile
gth1ii
dexiforji1jle
gthjifajai
dexi
dexjtempai
dexai
dexaiaitempi
tijtempfori1ile
gthiforj0jle
gthijifajaj1tempajajaj1aj1tempfori1ile
gthiforjle
gth1ji1jifajaj1tempajajaj1aj1tempvoidQuickSorti
tai
tstarti
tstop快速排序i
tijtempifstartstopretur
istartjstoptempaiwhileijwhileijajtempjifijvoidEffervescei
tai
tle
gth冒泡排序
faiajiwhileijaitempiifijajaijaitempQuickSortastarti1QuickSortai1stopvoidMargei
tsrci
tdesti
tlowi
tmidi
thigh归并排序i
tijkilowjmidklowwhileimidjhighifsrcisrcjdestksrcielsedestksrcjifimidwhileimiddestksrcielseifjhighwhilejhighvoidMergeProcessi
tsrci
tdesti
t
i
tblocksize归并排序i
tilowmidhighlow0whilelow2blocksize
midlowblocksizehighlow2blocksizeMargesrcdestlowmidhighlow2blocksize第二步destksrcj第一步
fiflowblocksize
midlowblocksizehigh
Margesrcdestlowmidhighelseilowwhilei
destisrcivoidMergeSorti
tsrci
t
归并排序第三步i
tdesti
tmalloc
sizeofi
ti
tblocksize1whileblocksize
MergeProcesssrcdest
blocksizeblocksize2MergeProcessdestsrc
blocksizeblocksize2freedesti
tmai
i
tNippri
tf