Listing 1-1. Exercise 1, Part 1
1-20
Getting Started with ADSP-BF537 EZ-KIT Lite
{
unsigned int x, i, j, q;
x = v[ p ];
i = p - 1;
j = r + 1;
for ( ;; )
{
do { --j; } while ( v[ j ] > x );
do { ++i; } while ( v[ i ] < x );
if ( i < j )
{
int temp = v[ i ];
v[ i ] = v[ j ];
v[ j ] = temp;
}
else
{
q = j;
break;
}
}
quick_sort ( v, p, q );
quick_sort ( v, q + 1, r );
}
}
int out_b[ ARRAY_LENGTH ];
int out_m[ ARRAY_LENGTH ];
void main (){
int i;
srand ( 22 );
for ( i = 0; i < NUM_ITERATIONS; ++i )
{
randomize_arrays ( out_b, out_m, ARRAY_LENGTH );
bubble_sort ( out_b, ARRAY_LENGTH );
quick_sort ( out_m, 0, ARRAY_LENGTH - 1 );
}
}
www.BDTIC.com/ADI