Out of stack space

I have an ASP page that brings in a 2D array of data and prints it, sorts it and searches it.  Am having a problem with the sort algorithm.  Have a QuickSort algorithm which works and has good time runs.  Problem is when I attempt to sort a column with mostly the same data in it, I get the out of stack space error.
(Microsoft VBScript runtime error '800a001c'  Out of Stack Space).  I know that this error is popping up because my sort uses recursion and when you have a lot of the same data being sorted, that function is being called many times.  What I want to know is if there is any way and if it is safe to increase the Stack Space or if I should go with a different algorithm?  Which brings me to my second question.  I have been trying to run a shell sort algorithm but keep getting small errors in my results.  For example say we have the following elements in the array (A,B,B,C,B,A,A,A,B,C,B,C)  The sorted array will come out as follows:
(A,A,A,B,A,B,B,B,C,B,C,C)  I can't figure out if its the amount of data I am attempting to sort or if I'm just screwing up.  I guess if anyone has some good vbscript quicksort or shell sort algorithms that are proven and and willing to share those, I would appreciate it.  Thanks.
Who is Participating?
discussion of sorting algorithms and samples in VB, translation to VBScript should be no problem:

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.