Advanced Programming Course - Exercise 3

http://www.oocities.org/SiliconValley/Peaks/8778/TAU_advprog.html

To write an implementation of the "Selection Sort" algorithm for linked list of integers. The implementation may be either iterative or recursive.

You can use the example of linked list of integers ( http://www.oocities.org/SiliconValley/Peaks/8778/TAU_advprog-IntList.html ) as a template for your program. So the function you have to write is:

NODE* SelectionSort( NODE* list);
The main() function may look:

int main()
{
	/* -100 - sign of the end of values */
	static int vals[] = { 1, 2, 5, 6, 3, 2, 6, 3, 1, 3, -100 };
	int i;
	NODE* list = 0;

	for( i = 0; vals[i] != -100; i ++)
		il_insert( &list, vals[i], AS_IS);
	printf( "After insertion => ");
	il_print( list);
	list = SelectionSort( list);
	printf( "After sort => ");
	il_print( list);

	return( 0);
}