#include #include #include //For greater( ) #include #include #include using namespace std; //myAlgo_make_heap1.cpp void find_lowerbound(int); int n1[] = { 61 ,60,53,59,65,64,71,70,68,64 }; static int i=0; vectorv1; int main () { // ostream_iterator< int > output( cout, " " ); vectorv1(n1, n1+10), v2; vector::iterator it; cout<<"\n ostream_iterator outout --\n"; copy(v1.begin(),v1.end(), output); cout<<"\n make_heap ---"; cout<<"\n vector _iterator outout --\n"; make_heap(v1.begin(),v1.end()); for(it=v1.begin(); it !=v1.end(); it++) { cout<< "\n\t" << *it << " at : " << i; i++; } cout<<"\n ------------\n"; cout<<"\n The report below shows that " ; cout<<"\n the value is greater than the current "; cout<<"\n can be inserted at "; for(it=v1.begin(); it !=v1.end(); it++) { find_lowerbound(*it); i++; } return 0; } void find_lowerbound(int value) { cout<<"\n lower bound of "<< value << " is at "; // vectorv1(n1, n1+10); vector< int >::iterator it; it = upper_bound( v1.begin(), v1.end(), value ); cout<< " :" << int( it - v1.begin() ); }