Skip to content

Instantly share code, notes, and snippets.

@sdarlington
Created May 6, 2011 09:56
Show Gist options
  • Save sdarlington/958711 to your computer and use it in GitHub Desktop.
Save sdarlington/958711 to your computer and use it in GitHub Desktop.
Bubblesort implementation for Sybase Aleri (SPLASH)
int32 bubble_sort_double (vector(double) data) {
int32 v_len := size(data);
int32 v_outer := 0;
while (v_outer < v_len) {
int32 v_curr := 1;
while (v_curr < v_len - v_outer) {
if (data[v_curr - 1] > data[v_curr]) {
swap_double (data, v_curr, v_curr - 1);
}
v_curr++;
}
v_outer++;
}
}
int32 swap_double (vector(double) data, int32 el1, int32 el2) {
double temp := data[el1];
data[el1] := data[el2];
data[el2] := temp;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment