partition array into n/5 groups

Hey I am working on a project where I need to use deterministic linear time algroithm to find the median of a large array. I am doing my program in c++. I am unsure on how to partition an array of size n into n/5 groups of size 5. Any help would be greatly appreciated.
do this:
1
2
3
4
5
int pb,pt; //the bottom and top of each partition
for(pb=0;pb<n;pb+=5){
	pt=(n-pb<5)?n:pb+5;
//do whatever with the partition here
}
Last edited on
Topic archived. No new replies allowed.