Data Structures and Algorithms

Homework 08

Question 1.
Perform the mergesort algorithm with the input sequence: 30, 40, 24, 58, 48, 26, 11, 13. Use a diagram to illustrate the sorting process.

Question 2.
Repeat above question but using quicksort instead.

Question 3.
Repeat above question but using bubble sort instead.

Question 3.
Repeat above question but using insertion sort instead.

Question 5.
Write a template function with type parameter T that sorts a vector (STL template) containing elements of type T in ascending order. Assume that the operator > and < works with values of type T. The template function should use bubblesort.