Skip to content

Commit

Permalink
Update example file
Browse files Browse the repository at this point in the history
  • Loading branch information
positively-charged committed Dec 9, 2016
1 parent db6acf9 commit 594ff0b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/sorting.bcs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ script "Main" open {
}

// Bubble sort.
void BSort( int[] list ) {
void BSort( int[]& list ) {
int left = list.length();
while ( left ) {
int i = 0;
Expand All @@ -49,7 +49,7 @@ void BSort( int[] list ) {
}

// Selection sort.
void SSort( int[] list ) {
void SSort( int[]& list ) {
int sorted = 0;
while ( sorted < list.length() ) {
int lowest = sorted;
Expand All @@ -68,7 +68,7 @@ void SSort( int[] list ) {
}

// Insertion sort.
void ISort( int[] list ) {
void ISort( int[]& list ) {
int sorted = 0;
while ( sorted < list.length() ) {
int value = list[ sorted ];
Expand All @@ -83,13 +83,13 @@ void ISort( int[] list ) {
}

// Merge sort.
void MSort( int[] list ) {
void MSort( int[]& list ) {
assert ( list.length() <= LIST_MAX_SIZE,
"too many values to sort for " + __FUNCTION__ + "()" );
MsortHalf( list, 0, list.length() );
}

private void MSortHalf( int[] list, int pos, int size ) {
private void MSortHalf( int[]& list, int pos, int size ) {
static int temp[ LIST_MAX_SIZE ];
int sizeL = size / 2;
int sizeR = size - sizeL;
Expand Down Expand Up @@ -140,7 +140,7 @@ private void MSortHalf( int[] list, int pos, int size ) {
}

// Shell sort.
void HSort( int[] list ) {
void HSort( int[]& list ) {
// Figure out initial increment.
int h = 0;
int hNext = 1;
Expand Down

0 comments on commit 594ff0b

Please sign in to comment.