2014年5月23日

判断是否AVL平衡二叉书

摘要: #include#include#include#include#include#include#includeusing namespace std;class node{public: int val; node* left; node* right; node():va... 阅读全文

posted @ 2014-05-23 16:01 berkeleysong 阅读(273) 评论(0) 推荐(0) 编辑

用递归方法判断两棵树是否相等

摘要: #include#include#include#include#include#include#includeusing namespace std;class node{public: int val; node* left; node* right; node():va... 阅读全文

posted @ 2014-05-23 11:59 berkeleysong 阅读(626) 评论(0) 推荐(0) 编辑

广度优先搜索求树的深度

摘要: #include#include#include#include#include#include#includeusing namespace std;class node{public: int val; node* left; node* right; node():va... 阅读全文

posted @ 2014-05-23 11:34 berkeleysong 阅读(243) 评论(0) 推荐(0) 编辑

堆排序

摘要: #include#include#includeusing namespace std; //void MinHeapFixup(int a[], int i)//{// int j ,temp;// temp = a[i];// j = (i-1)/2;// while(j >= 0 && i !... 阅读全文

posted @ 2014-05-23 10:50 berkeleysong 阅读(166) 评论(0) 推荐(0) 编辑

归并排序

摘要: #includeusing namespace std;///算法重要,但是思想更重要 void MemeryArray(int a[],int n,int b[],int m,int c[])///经典框架,be careful!{ int i,j,k; i = j = k = 0; while(... 阅读全文

posted @ 2014-05-23 09:49 berkeleysong 阅读(230) 评论(0) 推荐(0) 编辑

导航