0001 template <typename T> template <typename VST> //元素类型、操作器 0002 void BinNode<T>::travIn ( VST& visit ) { //二叉树中序遍历算法统一入口 0003 switch ( rand() % 5 ) { //此处暂随机选择以做测试,共五种选择 0004 case 1: travIn_I1 ( this, visit ); break; //迭代版#1 0005 case 2: travIn_I2 ( this, visit ); break; //迭代版#2 0006 case 3: travIn_I3 ( this, visit ); break; //迭代版#3 0007 case 4: travIn_I4 ( this, visit ); break; //迭代版#4 0008 default: travIn_R ( this, visit ); break; //递归版 0009 } 0010 }