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
#include <stdio.h> | |
#include <stdlib.h> | |
static void show(int *nums, int lo, int hi) | |
{ | |
int i; | |
for (i = lo; i <= hi; i++) { | |
printf("%d ", nums[i]); | |
} |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
static inline void swap(int *a, int *b) | |
{ | |
int tmp = *a; | |
*a = *b; | |
*b = tmp; |
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
import numpy as np | |
def decode(self, X, pi, A, B, N): | |
T = len(X) | |
delta = pi * B[:,X[0]] # P(X, Z | lamda) | |
varphi = np.zeros((T, N), dtype=int) | |
path = [0] * T | |
for i in range(1, T): | |
delta = delta.reshape(-1,1) # Nx1 | |
tmp = delta * self.A # NxN |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <unistd.h> | |
int main(void) | |
{ | |
int i, j, k; | |
int dim = 11; | |
int num = 1024 * 1024; |
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 sort(int *nums, int size) | |
{ | |
int i, flag = size; | |
while (flag > 0) { | |
int len = flag; | |
flag = 0; | |
for (i = 1; i < len; i++) { | |
if (nums[i - 1] > nums[i]) { | |
int tmp = nums[i - 1]; | |
nums[i - 1] = nums[i]; |
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 sort(int *nums, int size) | |
{ | |
int i, j; | |
for (i = 1; i < size; i++) { | |
int tmp = nums[i]; | |
for (j = i; j > 0 && tmp < nums[j - 1]; j--) { | |
nums[j] = nums[j - 1]; | |
} | |
nums[j] = tmp; | |
} |
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
#include <stdio.h> | |
#include <stdlib.h> | |
static inline void swap(int *a, int *b) | |
{ | |
int tmp = *a; | |
*a = *b; | |
*b = tmp; | |
} |
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
#include <stdio.h> | |
#include <stdlib.h> | |
static void show(int *nums, int lo, int hi) | |
{ | |
int i; | |
for (i = lo; i <= hi; i++) { | |
printf("%d ", nums[i]); | |
} |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
/* https://zhuanlan.zhihu.com/p/345364527 */ | |
static inline int max(int a, int b) | |
{ | |
return a > b ? a : b; | |
} |
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
HOST=linux-x86_64 | |
NDK=/opt/android-ndk-r8e | |
PLATFORM=$NDK/platforms/android-14/arch-arm | |
PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/$HOST | |
CPU=armv7-a | |
PREFIX=$(pwd)/../build_android/$CPU |
NewerOlder