Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Astrachan strikes again.

Name: Anonymous 2015-02-13 14:04

Due to its simplicity, bubble sort is often used to introduce the concept of an algorithm, or a sorting algorithm, to introductory computer science students. However, some researchers such as Owen Astrachan have gone to great lengths to disparage bubble sort and its continued popularity in computer science education, recommending that it no longer even be taught.

Name: Anonymous 2015-02-14 4:38

When n is less than 1 it's beneficial to increase time complexity as much as possible.
I suggest defining input as half an array of length m; therefore n = 1/2 as input is only 1/2 of an array.
Increasing time complexity is easy, just add nested loops, or if you're feeling fancy functions with loops that recursively call themselves.

Here, a more efficient hello world:
#include<stdio.h>
#include<stdlib.h>

void f(void*, int, int);

main(int argc, char *argv[]){
//Get half of argv
char **argv2 = malloc(sizeof(char *) * argc / 2);
int i;
for(i = 0; i <= argc / 2; ++i){
argv2[i] = argv[i];
}

//Call our efficiency function
f(argv, argc/2, 0);

printf("Hello, world!");
}

void f(void *array, int length, int depth){
if(depth == 10*length){
return;
}

int i;
for(i = 0; i < length; ++i){
f(array, length, depth + 1);
}
return;
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List