Last active
February 21, 2022 15:47
-
-
Save maoxiaoke/660f545ed97fb44bc4dedee391b214ec to your computer and use it in GitHub Desktop.
Revisions
-
maoxiaoke revised this gist
Feb 21, 2022 . 1 changed file with 0 additions and 24 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,24 +0,0 @@ -
maoxiaoke revised this gist
Feb 21, 2022 . 1 changed file with 0 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +0,0 @@ -
maoxiaoke revised this gist
Feb 21, 2022 . 1 changed file with 18 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1,18 @@ var prime = function(num){ var i,j; var arr = []; for(i = 1; i < num; i++){ for(j=2; j < i; j++){ if(i%j === 0) { break; } } if(i <= j && i !=1){ arr.push(i); } } return arr; }; -
maoxiaoke revised this gist
Feb 21, 2022 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ -
maoxiaoke revised this gist
Feb 21, 2022 . 2 changed files with 29 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ /** * Heap's algorithm */ function heapPermutation(arr,size,n){ var swap = function (index1,index2) { var temp = arr[index1]; arr[index1] = arr[index2]; arr[index2] = temp; } if (size === 1){ console.log(arr); return; } for (let i = 0; i < size; i++){ heapPermutation(arr, size -1,n); swap(size % 2 ? 0 : i, size - 1); } } var arr = ['a','b','c','d']; heapPermutation(arr,arr.length,arr.length); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ // 递归 function gcd(m ,n){ if(n) return gcd(n,m%n); return m; } -
maoxiaoke revised this gist
Feb 21, 2022 . 2 changed files with 0 additions and 29 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,24 +0,0 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +0,0 @@ -
maoxiaoke revised this gist
Feb 21, 2022 . 2 changed files with 29 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ /** * Heap's algorithm */ function heapPermutation(arr,size,n){ var swap = function (index1,index2) { var temp = arr[index1]; arr[index1] = arr[index2]; arr[index2] = temp; } if (size === 1){ console.log(arr); return; } for (let i = 0; i < size; i++){ heapPermutation(arr, size -1,n); swap(size % 2 ? 0 : i, size - 1); } } var arr = ['a','b','c','d']; heapPermutation(arr,arr.length,arr.length); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ // 递归 function gcd(m ,n){ if(n) return gcd(n,m%n); return m; } -
maoxiaoke revised this gist
Feb 21, 2022 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1,5 @@ // 递归 function gcd(m ,n){ if(n) return gcd(n,m%n); return m; } -
maoxiaoke revised this gist
Feb 21, 2022 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ -
maoxiaoke revised this gist
Feb 21, 2022 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +0,0 @@ -
maoxiaoke revised this gist
Feb 21, 2022 . 1 changed file with 24 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1,24 @@ /** * Heap's algorithm */ function heapPermutation(arr,size,n){ var swap = function (index1,index2) { var temp = arr[index1]; arr[index1] = arr[index2]; arr[index2] = temp; } if (size === 1){ console.log(arr); return; } for (let i = 0; i < size; i++){ heapPermutation(arr, size -1,n); swap(size % 2 ? 0 : i, size - 1); } } var arr = ['a','b','c','d']; heapPermutation(arr,arr.length,arr.length); -
maoxiaoke revised this gist
Feb 21, 2022 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ -
maoxiaoke created this gist
Feb 21, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@