算法导论(CLRS, 2nd) 个人答案 Ch2.1
摘要:2.1-1:2.1-2:NON-INCREASING-INSERTION-SORT(A) forj: 1~ length(A)-1: if(A[j]< A[j-1]): key= A[j]; t = j-1; while(A[t]< key && t>=0): A[t+1]= A[t]; t--; A[t]= key; returnA;2.1-3:// Assumption: Ifthere're duplicated elements, only return// the index of the first element.LINEAR-SEARC
阅读全文
算法导论(CLRS, 2nd) 个人答案 Ch1
摘要:1.1-1Sorting: rank thestudent's according to the scoreDetermining thebest order for multiplying matrices: When doingprobability calculation, one may require lots of matrices multiplication for the cumulative probabilityresultsFinding the convexhull: 1.1-2Space1.1-3Linked list:Strength: can beuse
阅读全文