///三叉链表
//#pragma once
//#include
//#include
//using namespace std;
//template
//struct BinaryTreeNode_P
//{
//T _data;
//BinaryTreeNode_P* _left;
//BinaryTreeNode_P* _right;
//BinaryTreeNode_P* _parent;
//BinaryTreeNode_P(const T& x)
//:_data(x)
//, _left(NULL)
//, _right(NULL)
//, _parent(NULL)
//{}
//};
//
//template
//class BinaryTree_P
//{
//protected:
//BinaryTreeNode_P* _CreateTree(T a[], size_t& index, const size_t size)
//{
//BinaryTreeNode_P* root = NULL;
//if (index
//{
//root = new BinaryTreeNode_P(a[index]);
//root->_left = _CreateTree(a, ++index, size);
//if (root->_left)
//root->_left->_parent = root;
//root->_right = _CreateTree(a, ++index, size);
//if (root->_right)
//root->_right->_parent = root;
//}
//return root;
//}
//public:
//BinaryTree_P()
//:_root(NULL)
//{}
//BinaryTree_P(T* a, size_t size)
//{
//size_t index = 0;
//_root = _CreateTree(a, index, size);
//}
//void PreOrder_Non_R()
//{
//stack*> s;
//if (_root)
//s.push(_root);
//while (!s.empty())
//{
//BinaryTreeNode_P* top = s.top();
//cout <_data <
//s.pop();
//if (top->_right)
//s.push(top->_right);
//if (top->_left)
//s.push(top->_left);
//}
//cout <
//}
//protected:
//BinaryTreeNode_P* _root;
//};
本文发布于:2024-02-03 06:47:50,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170691407049339.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |