摘要: Construct Binary Tree from Inorder and Postorder Traversal Given inorder and postorder traversal of a tree, construct the binary tree. 根据后序遍历和中序遍历构建一棵 阅读全文
posted @ 2016-11-12 15:09 WillWu 阅读(157) 评论(0) 推荐(0) 编辑
摘要: Construct Binary Tree from Preorder and Inorder Traversal Given preorder and inorder traversal of a tree, construct the binary tree. 分析: 根据前序遍历和中序遍历构造 阅读全文
posted @ 2016-11-12 15:01 WillWu 阅读(164) 评论(0) 推荐(0) 编辑
摘要: Validate Binary Search Tree Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left sub 阅读全文
posted @ 2016-11-12 12:27 WillWu 阅读(131) 评论(0) 推荐(0) 编辑
摘要: Longest Valid Parentheses Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses su 阅读全文
posted @ 2016-11-07 12:17 WillWu 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 参考 Poll的笔记 http://www.cnblogs.com/maybe2030/p/4715042.html 直接插入排序 基本思想:将待排序的无序数列看成是一个仅含有一个元素的有序数列和一个无序数列,将无序数列中的元素逐次插入到有序数列中,从而获得最终的有序数列。 示意图: 时间复杂度:O 阅读全文
posted @ 2016-10-30 19:59 WillWu 阅读(530) 评论(0) 推荐(0) 编辑
摘要: 参考 skywang12345 http://www.cnblogs.com/skywang12345/p/3576969.html AVL树的介绍 AVL树是根据它的发明者G.M. Adelson-Velsky和E.M. Landis命名的。它是最先发明的自平衡二叉查找树,也被称为高度平衡树。相比 阅读全文
posted @ 2016-10-28 13:53 WillWu 阅读(525) 评论(0) 推荐(0) 编辑
摘要: 转载 skywang12345 http://www.cnblogs.com/skywang12345/p/3576328.html 树的介绍 1. 树的定义 树是一种数据结构,它是由n(n>=1)个有限节点组成一个具有层次关系的集合。 把它叫做“树”是因为它看起来像一棵倒挂的树,也就是说它是根朝上 阅读全文
posted @ 2016-10-28 13:47 WillWu 阅读(51556) 评论(0) 推荐(7) 编辑
摘要: 二分查找 说明:查找的数组或列表必须是有序的,若无序,先进行排序 复杂度:时间复杂度 O(log2n),空间复杂度O(n) C++源码(递归和非递归两个版本) 斐波那契查找 在介绍斐波那契查找算法之前,我们先介绍一下很它紧密相连并且大家都熟知的一个概念——黄金分割。 黄金比例又称黄金分割,是指事物各 阅读全文
posted @ 2016-10-27 21:46 WillWu 阅读(4355) 评论(0) 推荐(0) 编辑
摘要: Generate Parentheses Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, 阅读全文
posted @ 2016-10-25 23:02 WillWu 阅读(134) 评论(0) 推荐(0) 编辑
摘要: Implement regular expression matching with support for '.' and '*'. 阅读全文
posted @ 2016-10-25 16:19 WillWu 阅读(132) 评论(0) 推荐(0) 编辑