Data Structures and Algorithms

Lab 06 - Sorting

Note:One of the following exercises will be tested and marked as an programming assignment (10% of the final mark). Ask your lab instructor for submission deadline.

Exercise 1.
Write a program that reads a series of integers (separated by white spaces) from the text file EXX1.IN, then uses bubble sort to sort the sequence in ascending order and writes the result to the file named EXX1.OUT (each number in one line).

Exercise 2.
Write a program that reads a series of integers (separated by white spaces) from the text file EXX2.IN, then uses insertion sort to sort the sequence in descending order and writes the result to the file named EXX2.OUT. (each number in one line)

Exercise 3.
Modify your single linked list implementation in Lab03 to make it a template class. Write a program to test your new implementation using list of int, list of float, and list of char*, i.e. creating lists of different types then populate them with data.