2013年6月25日

二叉树 实现(部分代码 非递归遍历)

摘要: #include #include using namespace std;templateclass BinaryTree;templateclass BinaryTreeNode{ friend BinaryTree;private: BinaryTreeNode *left; BinaryTreeNode *right;public: T data; BinaryTreeNode(const T &item, BinaryTreeNode*lptr = NULL, BinaryTreeNode*rptr = NULL):data(item), left(lp... 阅读全文

posted @ 2013-06-25 18:00 tafancy 阅读(203) 评论(0) 推荐(0)

快排和堆排序代码

摘要: int partition(int data[], int lenth, int start, int end){ //assert(end start) { quikSort(data, index, start, index-1); } if (index void buildHeap(vector&a, int i, int len){ int child; T tmp; for (tmp = a[i]; getleft(i) tmp) { a[i] = a[child]; a[child] = tmp; } else { break; } }}templat... 阅读全文

posted @ 2013-06-25 15:08 tafancy 阅读(241) 评论(0) 推荐(0)

导航