#include #include #include #include #include #include struct Data { unsigned int o; unsigned int f; Data(unsigned int iO, unsigned int iF) : o(iO), f(iF) {} }; bool operator > (const Data& lhs, const Data& rhs){ return lhs.f > rhs.f; } std::ostream& operator << (std::ostream& o, const Data& data) { return o << "Order: " << data.o << " F: " << data.f; } void case1() { boost::heap::pairing_heap, boost::heap::compare > > openSet; openSet.push(Data(1,0)); openSet.push(Data(2,0)); Data d = openSet.top(); std::cout << d << std::endl; openSet.pop(); openSet.push(Data(3,0)); d = openSet.top(); std::cout << d << std::endl; openSet.pop(); d = openSet.top(); std::cout << d << std::endl; openSet.pop(); } void case2() { boost::heap::binomial_heap, boost::heap::compare > > openSet; openSet.push(Data(1,0)); openSet.push(Data(2,0)); Data d = openSet.top(); std::cout << d << std::endl; openSet.pop(); openSet.push(Data(3,0)); d = openSet.top(); std::cout << d << std::endl; openSet.pop(); d = openSet.top(); std::cout << d << std::endl; openSet.pop(); } int main(int argc, char *argv[]) { std::cout << "pairing_heap:stable" << std::endl; case1(); std::cout << "binomial_heap:stable" << std::endl; case2(); }