#include #include #include #include #include #include using namespace std; //my_partial_sort_copy1.cpp void print(vector,int ); int main() { int n1[10] = { 69 ,60,63,61,65,64,68,64,71,70 }; vectorv1( n1, n1+10), v2; ostream_iterator< int > output( cout, " " ); cout<<"\n orignal array \n\t"; copy(v1.begin(),v1.end(), output); /* v2.resize(1); partial_sort_copy(v1.begin(), v1.begin()+1, v2.begin(), v2.end()); copy(v2.begin(),v2.end(), output); v2.resize(2); partial_sort_copy(v1.begin(), v1.begin()+2, v2.begin(), v2.end()); copy(v2.begin(),v2.end(), output); */ for(int i=1; i <=7; i++) { v2.resize(i); partial_sort_copy(v1.begin(), v1.begin()+i, v2.begin(), v2.end()); //copy(v2.begin(),v2.end(), output); print(v2, i) ; cout<<"\n"; } return 0; } void print(vectorv1, int n1) { vector::iterator it; cout<<"\n end point "<< n1 <<":"; for(it=v1.begin(); it !=v1.end(); it++) { cout << " "<< *it; } }