摘要: 1.随机表达式,如:(221.05 + 619.48) * ((221.05 + 619.48)) * ((221.05 + 619.48) * ((221.05 + 619.48))); Test: /// <summary> ///A test for BuildRandom expression ///</summary> [TestMethod()] public void BuildRa... 阅读全文
posted @ 2011-07-29 17:31 netfuns 阅读(288) 评论(0) 推荐(0) 编辑
摘要: 表达式求值 1. 验证字符串为表达式 2.分拆表达式为操作符,操作数,括号 确定操作符是二元或一元操作符 3.将操作符序列建立二叉树 4.对二叉树进行求值 叶子节点为操作数,父节点为操作符,递归求值 Test : [TestMethod()] public void CalculateTest() { BinTree<string> target = new BinTree<string>(); ... 阅读全文
posted @ 2011-07-29 13:45 netfuns 阅读(221) 评论(0) 推荐(0) 编辑
摘要: 1.广度便历二叉树,得到二叉树的深度 使用队列 2.深度便历二叉树, 得到二叉树的深度 使用堆栈 Test : /// <summary> ///A test for GetDepth ///</summary> [TestMethod()] public void GetDepthByDepthTraverse() { BinTree<int> target = new BinTree<int>... 阅读全文
posted @ 2011-07-29 13:36 netfuns 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 1.生成N 层二叉树 2.树节点值为随机值 Test: /// <summary> ///A test for BuildRandom ///</summary> public void BuildRandomTestHelper<T>() { BinTree<int> target = new BinTree<int>(); // TODO: Initialize to an appropria... 阅读全文
posted @ 2011-07-29 13:33 netfuns 阅读(191) 评论(0) 推荐(0) 编辑