www

导航

2019年2月28日 #

二叉搜索树与双向链表

摘要: public class Solution { public TreeNode Convert(TreeNode pRootOfTree) { if(pRootOfTree == null) return null; if(pRootOfTree.left==null&&pRootOfTree.right==null) return pRootOfTree; ... 阅读全文

posted @ 2019-02-28 22:28 www_practice 阅读(92) 评论(0) 推荐(0) 编辑

二叉搜索树的后序遍历序列

摘要: public boolean VerifySquenceOfBST(int[] sequence) { if(sequence == null || sequence.length==0) return false; int start = 0, end = sequence.length-1; return helper(sequence, start, end); }... 阅读全文

posted @ 2019-02-28 19:35 www_practice 阅读(150) 评论(0) 推荐(0) 编辑

栈的压入、弹出序列

摘要: public boolean IsPopOrder(int [] pushA,int [] popA) { if(pushA == null || popA==null || pushA.length==0 || pushA.length!=popA.length) { return false; } Stack stack =... 阅读全文

posted @ 2019-02-28 18:57 www_practice 阅读(89) 评论(0) 推荐(0) 编辑

顺时针打印矩阵

摘要: public static ArrayList printMatrix(int[][] matrix) { ArrayList ret = new ArrayList(); if(matrix == null||matrix.length==0||matrix[0].length==0) return ret; int m = matrix... 阅读全文

posted @ 2019-02-28 16:45 www_practice 阅读(209) 评论(0) 推荐(0) 编辑

树的镜像

摘要: public class Solution { public void Mirror(TreeNode root) { if(root == null) return; TreeNode temp = root.left; root.left = root.right; root.right = temp; Mirror(root.... 阅读全文

posted @ 2019-02-28 14:03 www_practice 阅读(127) 评论(0) 推荐(0) 编辑

树的子结构

摘要: public class Solution { public boolean HasSubtree(TreeNode root1,TreeNode root2) { boolean ret = false; if(root1 == null || root2 == null) return ret; ret = helper(root1,root2); ... 阅读全文

posted @ 2019-02-28 13:58 www_practice 阅读(127) 评论(0) 推荐(0) 编辑