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 characters
void merge(int[] arr, int start, int mid, int end, int[] tmp) { | |
int i = 0; | |
int j = 0; | |
int k = 0; | |
while (i <= mid && j <= end) { | |
if (arr[i] < arr[j]) { | |
tmp[k++] = arr[i++]; | |
} else { | |
tmp[k++] = arr[j++]; | |
} |
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 characters
var nums = new Array(); | |
for (var i=0;i<10;i++){ | |
nums.push(i); | |
} | |
var outputs = [0,0,0,0]; | |
for (var j=0;j<4;j++){ | |
var idx = (Math.random() * nums.length) | 0; | |
outputs[j] = nums[idx]; | |
nums.splice(idx,1); | |
} |
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 characters
private static int[] BASE_CHARS; | |
static { | |
BASE_CHARS = new int[26]; | |
int a_idx = (int)'a'; | |
for (int i=0; i<26; i++) { | |
BASE_CHARS[i] = a_idx + i; | |
} | |
} |
NewerOlder