not one pass: 1)Take 2 pointer move one pointer by 5 position ie, the difference between the two pointer is 5. 2)Now traverse through the list till th ...
分类:
其他好文 时间:
2017-12-10 11:15:15
阅读次数:
186
广度优先遍历(breadth-first traverse,bfts),称作广度优先搜索(breath first search)是连通图的一种遍历策略。之所以称作广度优先遍历是因为他的思想是从一个顶点V0开始,辐射状地优先遍历其周围较广的区域。 算法描述 给定图G=(V,E)。V是节点集合,E是边 ...
分类:
编程语言 时间:
2017-10-08 10:16:05
阅读次数:
194
广度优先遍历(breadth-first traverse,bfts),称作广度优先搜索(breath first search)是连通图的一种遍历策略。之所以称作广度优先遍历是因为他的思想是从一个顶点V0开始,辐射状地优先遍历其周围较广的区域。 算法描述 给定图G=(V,E)。V是节点集合,E是边 ...
分类:
其他好文 时间:
2017-10-07 20:49:08
阅读次数:
217
在使用 SSH时候出现node to traverse cannot be null错误,一般是你sql语句写错了。 比如把:from写成form了,自己就是这个问题 还有比如set A = 1 and B = 2,应该是不用and,而是用逗号隔开 ...
分类:
其他好文 时间:
2017-09-23 19:05:52
阅读次数:
118
#include #include typedef struct CLinkList { int data; struct CLinkList *next ; } node; /*initiate a circle list*/ void ds_init(node **pNode) { int it... ...
分类:
其他好文 时间:
2017-09-14 23:25:15
阅读次数:
98
题目原文: Design an algorithm to perform an inorder traversal of a binary search tree using only a constant amount of extra space. 1 public void traverse( ...
分类:
其他好文 时间:
2017-08-14 19:00:13
阅读次数:
202
参考资料: http://xxgblog.com/2016/04/02/traverse-list-thread-safe/ 一些列表类及其特性 1. 线程安全的列表类并不意味着调用它的代码就一定线程安全 2. 只有CopyOnWriteArrayList能支持在遍历时修改列表元素 以下代码模拟多线 ...
分类:
编程语言 时间:
2017-07-08 00:21:14
阅读次数:
296
This is an easy question. No matter what kind of method you chose, the time complexity is at least O(m*n), becasue you have to traverse each element a ...
分类:
其他好文 时间:
2017-06-03 09:49:10
阅读次数:
292
1 102 Binary Tree Level Order Traverse public class Solution { public List<List<Integer>> levelOrder(TreeNode root) { Queue<TreeNode> queue = new Link ...
分类:
其他好文 时间:
2017-05-13 21:03:30
阅读次数:
146
5月12日 1 94 Binary Tree Inorder Traverse 栈 public List<Integer> inorderTraversal(TreeNode root) { List<Integer> list = new ArrayList<>(); Stack<TreeNod ...
分类:
其他好文 时间:
2017-05-12 15:32:34
阅读次数:
156