1、精品精品精品精品精品精品精品精品精品精品精品SS(int data,int n)void SS(int data,int n)精品精品A B C D A B D C A C B D A C D B A D C B A D B C B A C D B A D C B C A D B C D A B D C A B D A C C B A D C B D A C A B D C A D B C D A B C D B A D B C A D B A C D C B A D C A B D A C B D A B C精品精品精品精品0100020003000400050006000700023456
2、789 10 11 12 13 14 15 16 17 18輸入資料量(n)執行次數演算法A演算法B精品精品請注意在上圖中,當請注意在上圖中,當n 14(=n0)之後,之後,c g(n)一定會大於或等於一定會大於或等於f(n)(5n2 4n2+174),),所以所以O(n2)足以代表足以代表4n2+174。02004006008001000120014001600180023456789 10 11 12 13 14 15 16 17 18n執行次數f(n)g(n)c*g(n)精品精品精品精品0200400600800100012002345678910nO(g(n)O(1)O(logn)O(n)O(nlogn)O(n2)O(2n)020004000600080001000012000102030405060708090100nO(g(n)O(1)O(logn)O(n)O(nlogn)O(n2)大大O表示函數的優劣順序為:表示函數的優劣順序為:O(1)O(logn)O(n)O(nlogn)O(n2)O(n3)O(2n)。精品精品精品精品最佳最佳(optimal)演算法演算法精品精品