还是抛砖Data Structures and Algorithm Analysis in C++, Mark Allen WeissData Structures & Algorithms in Java, Robert Lafore.入门挺好的joyce: 我来推荐 ...
这里说道“第四,dummy head非常有用,可以使代码简洁很多,并且容易写bug free的code。这个技巧可以大量使用”不是很能体会到dummy head的用途大家能举几个常见的 ...
大家好!图片中的代码是为了解决leetcode里reverse nodes in k-group问题的。其中cur.next=pre.next我想了很久都无法理解,因为第一次循环的时候cur=pre.next.如果有学有余 ...
LintCode链接 http://lintcode.com/en/problem/implement-iterator-of-binary-search-tree/左下角有一个Super Star: Extra memory usage O(1) 我想了想如果要满足hasNext ...
google电面fail掉的题:有个List,里面有duplicates,比如[A,B,B,A,C].现在有另一个input是一个int存放minimal distance。要求return的list里让duplicate之间的最小距 ...
大部分题目虽然都是算法的,感觉其实数据结构还是非常重要的尤其对于非cs专业自学者,个人感觉读起来这本书(免费pdf)讲的http://opendatastructures.org/对数据结构的理 ...
本人Java 不是特别好,这里请教一个简单的问题,向BST(binary search tree) 插入一个新节点的方法 ,我写了一个recursive的,但是要插入的这个节点没有被插上,原树里面这 ...
[ 本帖最后由 voiding 于 2014-11-9 11:32 编辑 ]\n\n又遇到recursion的问题想请教大家,下面的code的是Binary Search Tree的delete a node的code, 我不理解这里 x.left ...
通常递归写法的空间复杂度到底是O(h)还是O(logn)? 被搞糊涂了。
想系统练一练,多谢了
比如trie, suffix array, interval tree之类的?要bug-free不容易啊。
This is an interview question in "Cracking the coding interview". My code and test cases are here: #include using namespace std; struct node { int ...
我有点搞混了对subtree的理解,不知道有没有人可以解释一下。。如果有一个这样的main binary tree (这里我拿了binary search tree来作例子): ...
career 4.1 題目:Implement a function to check if a tree is balanced. For the purposes of this question, a balanced tree is defined to be a tree such that no ...
我有个疑问,如果两个点之间有两条相同长度的最短路径,比如a->b=1,b->c=1,a->c=2那a-c之间的最短路径就是两条,那么Dijkstra方法好像是不能把两条都找出来吧?如果想 ...