随笔分类 -  数据结构、算法与应用

SartajSahni著 https://www.cise.ufl.edu/~sahni/dsaaj/
摘要:We may represent a subset of n elements by the one-dimensional array x[1:n], where x[j] is one if element j is included in the subset and x[j] is zero 阅读全文
posted @ 2016-04-13 16:43 shamgod 阅读(296) 评论(0) 推荐(0)
摘要:The root is the first node to be visited in preorder. After we visit this node we must traverse the left subtree and then return to traverse the right 阅读全文
posted @ 2016-03-19 17:29 shamgod 阅读(257) 评论(0) 推荐(0)
摘要:The code to find the tree height using a postorder traversal is given below. 阅读全文
posted @ 2016-03-19 16:44 shamgod 阅读(152) 评论(0) 推荐(0)
摘要:例子中二叉树用链表示 1.后序遍历克隆和前序遍历克隆 The recursion stack space needed by both the preorder and postorder copy methods is O(h), where h is the height of the bina 阅读全文
posted @ 2016-03-19 16:36 shamgod 阅读(268) 评论(0) 推荐(0)
摘要:以下例子的树是存在数组中 1.中序遍历 2.平层遍历 阅读全文
posted @ 2016-03-19 16:29 shamgod 阅读(263) 评论(0) 推荐(0)
摘要:一、二叉树的属性 1.属性1:用n个元素(n>0)画出的每棵二叉树正好有n-1条边 2.高度为h的(h>=0)的二叉树在树中至少有h及至多有2h-1个元素 证明:由于每层至少一个元素所以元素的数量至少是h。每个元素至多有两个孩子,所以第i层的元素数量至多是2i-1(i>0)个。对于h=0,元素的总数 阅读全文
posted @ 2016-03-18 23:39 shamgod 阅读(171) 评论(0) 推荐(0)

haha