Sorting With Binary Search Trees
Informal code for sorting array A of length n:
BSTSort(A)
for i=1 to n
TreeInsert(A[i]);
InorderTreeWalk(root);
Argue that this is ?(n lg n)
What will be the running time in the
- Worst case?
- Average case? (hint: remind you of anything?)