Sherwood算法消除最壞實例,以達到對任何實例都能有好的性能的效果
文件:
rd_list.c --> create a random sequence of n integers not equal to each other
list.c --> create a descending sequence of n integers not equal to each other
sherwood.c --> 就是該算法,靜態鏈表的長度默認設為1000,可在宏定義處修改
用法:
gcc -o sherwood sherwood.c
gcc -o rd_list rd_list.c
gcc -o list list.c
./rd_list s.txt 1000 產生一個長度為1000的互不相等的隨機序列,保存在s.txt中
./list s1.txt 1000 產生一個長度為1000的互不相等的降序序列,保存雜s1.txt中
./sherwood s1.txt 運行算法,比較其中的4個算法的性能差異
標簽:
Sherwood
算法
上傳時間:
2016-01-20
上傳用戶:ainimao