[ create a new paste ] login | about

Link: http://codepad.org/83I5npLW    [ raw code | output | fork ]

C++, pasted on May 20:
int deli(int a[], int dno, int vrh); //prototip

void hitro_uredi(int a[], int dno, int vrh){
	
	if(dno < vrh){
		int j = deli(a, dno, vrh);
		hitro_uredi(a, dno, j-1);
		hitro_uredi(a, j+1, vrh);
	}
	
}

int deli(int a[], int dno, int vrh){
	
	int pe = a[dno]; // pivot
	int levi = dno;
	int desni = vrh;
	
	while(levi != desni){
		
		do{
			levi = levi + 1;
		}while((a[levi] <= pe) && (levi < vrh))
		
		do{
			desni = desni - 1;
		}while((a[desni] >= pe) && (desni > dno))
		
		if(levi != desni){
			swap(a[levi], a[desni]):
		}
		
	}
	swap(a[dno], a[desni]);
	return d;
	
}


Output:
1
2
3
In function 'int deli(int*, int, int)':
Line 25: error: expected `;' before 'do'
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: