代码摘自:https://www.cnblogs.com/lujiannt/p/9246256.html 1.CRC16算法 public class CRC16Util { /** * 计算CRC16校验码 * * @param bytes * @return */ public static String getCRC(byte[] bytes) { int CRC = 0x0000ffff; int POLYNOMIAL = 0x0000a001; int i, j; for (i = 0…
第23章 排序算法 Sorting:1 sort Sort elements in range (function template)2 stable_sort Sort elements preserving order of equivalents (function template)3 partial_sort Partially Sort elements in range (function template)4 partial_sort_copy Copy and parti…
function swap(arr,l,r){ var temp=arr[l]; arr[l]=arr[r]; arr[r]=temp; } function partition(arr,camp,left,right){ var index=left; var p=arr[index]; swap(arr,index,right);//交换key到最后一位 for(var i=left;i<right;i++){//注意i<right,为使其不用和key做比较 if(camp(arr[i],…