function bubble_sort(A){ for(let i=A.length-1;i>=1;i--){ for(let j =0 ;j<=i;j++){ A[j-1]>A[j]&&swap(A,j-1,j)//妿åé¢çæ°å¤§å°±äº¤æ¢ä½ç½® } } } function swap(A,i,j){ const t = A[i] A[i]=A[j] A[j]=t } // æ§è¡æ¶é´å¤§æ¦æ¯ï¼ï¼N^2-N)/2