摘要: /*** 广度优先遍历* **/public void BreadthFirstTreeWalk(BSTreeNode root, Action> func) { if (root == null) { return; } List> processQueue = new List>(); processQueue.Add(root); BSTreeNode current; while (pr... 阅读全文
posted @ 2017-04-11 23:52 xiejunzhao 阅读(588) 评论(0) 推荐(0)
摘要: /*** 非递归 中序遍历* **/public void InOrderTreeWalk(BSTreeNode root, Action> func) { if (root == null) { return; } Stack> stack = new Stack>((int)(2 * Math.Log(Count + 1))); BSTreeNode current = root; whil... 阅读全文
posted @ 2017-04-11 23:50 xiejunzhao 阅读(296) 评论(0) 推荐(0)
摘要: Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the absolute difference between i and j is at most k.p... 阅读全文
posted @ 2017-04-11 22:55 xiejunzhao 阅读(198) 评论(0) 推荐(0)