Data Structure and Algorithm (C # Implementation) Series --- Generalized Tree (2)

zhaozj2021-02-16  44

Data Structure and Algorithm (C # Implementation) Series --- Generalized Tree (2)

HEAVENKILLER (original)

Public override object key {get {return this.key;}}

Public override uint deterree {get {return this.degree;}}

// public override uint height {get {return this.height;}}

Public override Bool ISempty () // Property Takes The Place of ISempty ()

{

Return false; // generaltree Won't be EMPTY for EVER

}

Public override bool isleaf ()

{

Return this.degree == 0; // if this Tree's Degree Is Zero, IT Means The Tree Has No Subtrees, SO IT IS Leaf Certainly

}

// OverWrite Object.equals () --- Reference Type Realization

Public Override Bool Equals (Object_Obj)

{

IF (! base.equals (_obj))

Return False; // The base class is not equal, then it is not equal.

Some of the items in the base class can be eliminated

/ / It is determined in the base class as a generaltree type, so the transformation will not fail.

GENERALTREE TMPTREE = (generaltree) _obj;

// Compare reference members

IF (! Object.equals (this.treeelist, tmptree.treeelist))

Return False;

// Compare value type members

Return True;

}

}

}

转载请注明原文地址:https://www.9cbs.com/read-23119.html

New Post(0)