Correct the condition of recusive end point; add unsorted array generation.