码迷,mamicode.com
首页 >  
搜索关键字:traverse    ( 100个结果
Option Traverse
...
分类:其他好文   时间:2016-04-24 11:00:33    阅读次数:111
Course Schedule II; BFS; DFS;
We can use bfs to solve this problem; By traverse the prerequisites array, we can generate two graph representations. One is an array of list of out n
分类:其他好文   时间:2016-02-23 08:24:58    阅读次数:148
Jan 29 - Flatten Binary Tree To Linked List; DFS;
Using DFS to traverse the tree. 4 cases for each node in the tree: case 1: it's a leaf node, set a pointer pointing to the node. We're reaching an end
分类:其他好文   时间:2016-01-30 09:37:00    阅读次数:204
Jan 28 - Construct Binary Tree From Preorder And Inorder; Tree; DFS; Array
Using DFS to traverse the node and build the a tree. for a node, it has following properties: If its a left child node of its parent, then the left bo
分类:其他好文   时间:2016-01-29 08:42:46    阅读次数:168
Jan 27 - Valid Binary Search Tree; DFS;
Using DFS to traverse the BST, when we look through the BST to a certain node, this node must have the following property to make sure the tree is a v
分类:其他好文   时间:2016-01-28 13:45:06    阅读次数:152
Remove Duplicates From Sorted List II
First we need to get the head node, use a boolean value to mark whether we find a new head or not. When we traverse the linked list,if(cur.val != cur....
分类:其他好文   时间:2016-01-24 08:09:34    阅读次数:147
Jan 11 - Contains Duplicate II; Array; Traverse; HashMap; HashSet;
代码:public class Solution { public boolean containsNearbyDuplicate(int[] nums, int k) { //int gap = nums.length; Map map = new HashMap...
分类:其他好文   时间:2016-01-12 07:44:44    阅读次数:279
Jan 11 - Contains Duplicate; Array; Traverse; Integer;
遍历数组找出有没有重复的元素 首先想到用一个数组记录出现的元素的个数代码:public class Solution { public boolean containsDuplicate(int[] nums) { if(nums.length == 0) return true...
分类:其他好文   时间:2016-01-12 06:36:34    阅读次数:135
家庭作业汇总
家庭作业3.70C版本代码long traverse(tree_ptr tp){long v = MAX;//7:$922337206854775807if(tp != NULL){lv = traverse(tp->left);rv = traverse(tp->right);v = lv v ?...
分类:其他好文   时间:2015-11-21 00:40:54    阅读次数:256
20135306、20135307家庭作业3.70答案
家庭作业3.70(1)生成以上代码的C版本Long traverse(tree_ptrtp){Long v=MAX_LONG,rv,lv;If (tp!=NULL){lv=traverse(tp->left);rv=traverse(tp->right);v=lvtp->v?tp->v:v//Lin...
分类:其他好文   时间:2015-10-26 20:27:45    阅读次数:105
100条   上一页 1 ... 5 6 7 8 9 10 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!