aaronmk2 0 Junior Poster in Training

Can someone explain to me what is going on in this code. I am leaving comments by each line.

void qs::quicksort(int set[], int start, int end){
	stack<int>s;//starts a stack to hold them elements
	s.push(start);//why push two elements, why not one so the while loop works
	s.push(end);
	while (!s.empty()) { //does it need an infinity loop before it so it works more then once?
		s.pop();
		s.pop();
		if (end<=1) continue;//don't understand this line
		int i=partition(set, start, end);//I understand this.
		if (i-start>end-i) {
			s.push(start);//pushing in the first element
			s.push(i-1);//the one before the partition
			s.push(i+1);//the one after the partition
			s.push(end);}//the last element
		if (end-i<=i-start) {//ignore the rest
				s.push(start);
				s.push(i-1);
			}
		}
}