

 Thread Tools  Search this Thread 
#1
 
 
How to use the pop_heap() in C++ coding I am the student of the BscCS. I must have to submit the assignment on the functions of the C++ library in four days. I could also had the well knowledge of the functions that could be used in the C++ programming language. Even though, I could not know much more about the pop_heap() function of the C++ programming language. So, I would like to know about the pop_heap() function of the C++ programming language. I also would like to know How to use the pop_heap() in C++ coding. Reply Me!! 
#2
 
 
The pop_heap() in C++ coding The pop_heap() function can be used for an element that can be from the given heap range to pop that an element. The pop_heap() function can resequence an elements in the given specified range [fst,lst) in such a manner that the some place of considered a heap can be narrowed by one by deleting its highest an element. The following can be the general syntax of the pop_heap() function in the C++ : Code: template <class RndmAcsItrtr> void pop_heap ( RndmAcsItrtr fst, RndmAcsItrtr lst ); Last edited by Praetor : 05032010 at 05:12 PM. 
#3
 
 
Use the pop_heap() in C++ coding The program that can be mentioned below illustrates you about how to use the pop_heap() function in the C++ language programming : Code: #include <iostream> #include <algorithm> #include <vector> using namespace std; int main () { int mit[] = {10,20,30,5,15}; vector<int> w(mit,mit+5); vector<int>::iterator it; make_heap (w.begin(),w.end()); cout << "initial max heap : " << w.front() << endl; pop_heap (w.begin(),w.end()); w.pop_back(); cout << "max heap after pop : " << w.front() << endl; w.push_back(99); push_heap (w.begin(),w.end()); cout << "max heap after push: " << w.front() << endl; sort_heap (w.begin(),w.end()); cout << "final sorted range :"; for (unsigned k=0; k<w.size(); k++) cout << " " << w[k]; cout << endl; return 0; } Code: initial max heap : 30 max heap after pop : 20 max heap after push: 99 final sorted range : 5 10 15 20 99 
#4
 
 
How to use the pop_heap() in C++ coding The following can be the parameters of the pop_heap() function of the C++ language : 1. comp : This parameter of the pop_heap() function can contains an object of the comparison function that can takes two values of the similar type than those can consisted in the given specified range. 2. fst, lst : These parameters of the pop_heap() function can contains the randomAccess iterators to the final and starting positions of the heap that can be shrank by one. The range used can be as [fst,lst) that can contains all of an elements that can be between fst and lst. 
#5
 
 
How to use the pop_heap() The pop_heap() function of the C++ language can be used to delete the highest an element that can be defined as an element at the front of the heap from the specified heap. If an object of the weak sequencing comparison function can be given then it can be used instead of the "<" operator to compare an elements. The pop_heap() function can runs in a logarithmic time. The pop_heap() function of the C++ language can be comes under the <algorithm> header files. 

Tags: algorithm, cpp, functions, header files, pop_heap 
Thread Tools  Search this Thread 

Similar Threads for: "How to use the pop_heap() in C++ coding"  
Thread  Thread Starter  Forum  Replies  Last Post 
java coding  unikshegz  Software Development  1  27102010 01:56 AM 
Help me to use the transform() in C++ coding  Tailor  Software Development  5  19022010 04:17 PM 
Help in coding documents  Remedy  Software Development  5  11022010 02:34 AM 
C++ coding faster?  Chandrakant81  Software Development  3  17022009 10:51 PM 
Problem with C coding  SANDESH49  Software Development  2  02092008 01:23 PM 