string getstring()return integer parseint( )///end class tree app trees and red-black trees at this point trees and red-black trees (described in probably seem like entirely different entities howeverit turns out that in certain sense they are completely equivalent one can be transformed into the other by the application of few simple rulesand even the operations needed to keep them balanced are equivalent mathematicians would say they were isomorphic you probably won' ever need to transform tree into red-black treebut equivalence of these structures casts additional light on their operation and is useful in analyzing their efficiency historically the tree was developed firstlater the red-black tree evolved from it transformation from to red-black tree can be transformed into red-black tree by applying the following rulestransform any -node in the tree into black node in the red-black tree transform any -node into child (with two children of its ownand parent (with children and one other childit doesn' matter which item becomes the child and which the parent is colored red and is colored black transform any -node into parent and two children and both with two children of their own and are colored red and is black figure shows these transformations the child nodes in these subtrees are colored redall other nodes are colored black