void insertSort(int a[], int N)
{
int temp;
int j;
for (int i = 1; i < N; i++) {
if (a[i] >= a[i-1]) continue;
temp = a[i];
for (j = i - 1; a[j] > temp; j--) {
if (j<0) break;
a[j+1] = a[j];
}
a[j+1] = temp;
}
for (int i = 0; i < N; i++) {
NSLog(@"insert sort::%d", a[i]);
}
}
void binaryInsertSort(int a[], int N)
{
}
void bubbleSort(int *a, int N)
{
int temp;
for (int i = 0; i < N - 1; i++) {
for (int j = 0; j < N - i - 1; j++) {
if (a[j] > a[j+1]) {
temp = a[j];
a[j] = a[j+1];
a[j+1] = temp;
}
}
}
for (int i = 0; i < N; i++) {
NSLog(@"bubble sort::%d", a[i]);
}
}