/***************************************** * Instructions * - Replace 'uwuserid' with your uWaterloo User ID * - Select the current calendar term and enter the year * - List students with whom you had discussions and who helped you * * uWaterloo User ID: uwuserid @uwaterloo.ca * Submitted for ECE 250 * Department of Electrical and Computer Engineering * University of Waterloo * Calender Term of Submission: (Winter|Spring|Fall) 201N * * By submitting this file, I affirm that * I am the author of all modifications to * the provided code. * * The following is a list of uWaterloo User IDs of those students * I had discussions with in preparing this project: * - * * The following is a list of uWaterloo User IDs of those students * who helped me with this project (describe their help; e.g., debugging): * - *****************************************/ #ifndef LEFTIST_HEAP_H #define LEFTIST_HEAP_H #ifndef nullptr #define nullptr 0 #endif #include "Leftist_node.h" template class Leftist_heap { private: Leftist_node *root_node; int heap_size; public: Leftist_heap(); Leftist_heap( Leftist_heap const & ); ~Leftist_heap(); void swap( Leftist_heap &heap ); Leftist_heap &operator=( Leftist_heap ); bool empty() const; int size() const; int null_path_length() const; Type top() const; int count( Type const & ) const; void push( Type const & ); Type pop(); void clear(); // Friends template friend std::ostream &operator<<( std::ostream &, Leftist_heap const & ); }; // some sample functions are given template Leftist_heap::Leftist_heap(): root_node( nullptr ), heap_size( 0 ) { // does nothing } template Leftist_heap::Leftist_heap( Leftist_heap const &heap ): root_node( nullptr ), heap_size( 0 ) { // Traverses through the argument heap and pushes the entries // into this heap--you may use whatever traversal you want } template Leftist_heap::~Leftist_heap() { clear(); // might as well use it... } template void Leftist_heap::swap( Leftist_heap &heap ) { std::swap( root_node, heap.root_node ); std::swap( heap_size, heap.heap_size ); } template Leftist_heap &Leftist_heap::operator=( Leftist_heap rhs ) { swap( rhs ); return *this; } // Your implementation here // STRONG HINT: Write a default definition of each function, even if // it only returns the default value (false, 0, or Type()). // // Once you have done this, you can proceed and implement the member functions // one at a time. If you do not, and just start implementing the member // functions so that you can't compile and test your function, good luck. :-) // You can modify this function however you want: it will not be tested template std::ostream &operator<<( std::ostream &out, Leftist_heap const &heap ) { return out; } // Is an error showing up in ece250.h or elsewhere? // Did you forget a closing '}' ? #endif