**fig6_52.txt** /* 1*/ template /* 2*/ class Binom_Node /* 3*/ { /* 4*/ private: /* 5*/ Etype Element; /* 6*/ Binom_Node *L_Sib; // Left sibling. /* 7*/ Binom_Node *R_Sib; // Right sibling. /* 8*/ Binom_Node *F_Child; // First child. /* 9*/ unsigned int Rank; /*10*/ friend class Binom_Heap; /*11*/ Binom_Node( Etype E = 0, Binom_Node *L = NULL, /*12*/ Binom_Node *R = NULL, Binom_Node *F = NULL, /*13*/ unsigned int Ra = 0 ) : Element( E ), L_Sib( L ), /*14*/ R_Sib( R ), F_Child( F ), Rank( Ra ) { } /*15*/ }; /* 1*/ template /* 2*/ class Binom_Heap /* 3*/ { /* 4*/ private: /* 5*/ // Basic routines for binom_node. /* 6*/ Binom_Node *Merge_Tree( /* 7*/ Binom_Node *T1, /* 8*/ Binom_Node *T2 ); /* 9*/ Binom_Node *Merge( /*10*/ Binom_Node *H1, /*11*/ Binom_Node *H2 ); /*12*/ void Extract( Binom_Node * & T1, /*13*/ Binom_Node * & H1 ); /*14*/ void Destroy( Binom_Node *T ); /*15*/ Binom_Node *Copy( /*16*/ const Binom_Node *T ); /*17*/ void Swap( Binom_Node * & A, /*18*/ Binom_Node * & B ); /*19*/ Binom_Node *Root; /*20*/ Binom_Heap( Binom_Heap & Value ); // Disabled. /*21*/ public: /*22*/ // Constructors. /*23*/ Binom_Heap( unsigned int Initial_Size = 0 ) : Root( NULL ) { } /*24*/ // Destructor. /*25*/ ~Binom_Heap( ) { Destroy( Root ); } /*26*/ // Operator. /*27*/ const Binom_Heap & operator = ( const Binom_Heap & Value ); /*28*/ // Member functions. /*29*/ void Make_Empty( ) { Destroy( Root ); Root = NULL; } /*30*/ int Is_Empty( ) const { return Root == NULL; } /*31*/ void Insert( const Etype & X ); /*32*/ Etype Delete_Min( ); /*33*/ const Etype & Find_Min( ) const; /*34*/ void Merge( Binom_Heap & Value ); /*35*/ };