We shall present and discuss many sorting algorithms, that is, algorithms that arrange a collection of elements in order. We are ready to present one of them. Let's assume that the collection is given as an array.
sort(array a of size n) {
tree t = EmptyTree;
for i=0,1,...,n-1
t = insert(a[i],t);
print_in_order(t);
}
Can you modify this algorithm so that instead of printing the values
we store them back in the array in ascending order?