aaronmk2 0 Junior Poster in Training

I am having trouble with my quicksort. When I run my program it sorts them once( the lower half of the numbers are on one side, the higher half on the other). How can I get it to sort again without using a recursive function.

void qs::quicksort(int set[], int start, int end){
	stack<int>s;
	s.push(start);
	s.push(end);
	while (!s.empty()) {
		s.pop();
		s.pop();
		if (end<=1) continue;
		int i=partition(set, start, end);
		if (i-start>end-i) {
			s.push(start);
			s.push(i-1);
			s.push(i+1);
			s.push(end);}
			if (end-i<=i-start) {
				s.push(start);
				s.push(i-1);
			}
		}
}