摘要: 整数转为字符串public static String intToString(int n){ String str=""; boolean isPostive = n>0?true:false; n = Math.abs(n); while(... 阅读全文
posted @ 2015-09-22 10:39 hhrrrr 阅读(261) 评论(0) 推荐(0)
摘要: 递归//递归先序遍历 public static void pre(TreeNode root){ if(root==null) return; visit(root); if(root.left!=null) pre(root.left); ... 阅读全文
posted @ 2015-09-21 10:55 hhrrrr 阅读(198) 评论(0) 推荐(0)
摘要: 1.Java的内存机制 Java 把内存划分成两种:一种是栈内存,另一种是堆内存。在函数中定义的一些基本类型的变量和对象的引用变量都是在函数的栈内存中分配,当在一段代码块定义一个变量时,Java 就在栈中为这个变量分配内存空间,当超过变量的作用域后(比如,在函数A中调用函数B,在函数B中定义变量a,... 阅读全文
posted @ 2015-09-21 10:43 hhrrrr 阅读(245) 评论(0) 推荐(0)
摘要: 超文本传输协议 (HTTP-Hypertext transfer protocol) 是一种详细规定了浏览器和万维网服务器之间互相通信的规则,通过因特网传送万维网文档的数据传送协议。HTTP主要有这些不足,例举如下。 通信使用明文(不加密),内容可能会被窃听 不验证通信方的身份,因此有可能遭遇伪... 阅读全文
posted @ 2015-09-16 15:29 hhrrrr 阅读(311) 评论(0) 推荐(0)
摘要: mac上的jdk1.8删了换了1.7出了一堆毛病,小记一下(mac系统版本是10.10.2)1.删除jdk1.8直接去资源库里找到java文件下 然后把JavaVirtualMachines下的文件夹 即jdk1.8...直接删掉去终端 java -version 检查完毕 直接装jdk1.7两个命... 阅读全文
posted @ 2015-06-25 19:05 hhrrrr 阅读(440) 评论(0) 推荐(0)
摘要: 改造了一下maxdepth的代码 public static int minDepth(TreeNode root) { if(root==null) return 0; int height=0; Queue q=new LinkedList(); ... 阅读全文
posted @ 2015-06-24 20:03 hhrrrr 阅读(157) 评论(0) 推荐(0)
摘要: 问题描述: 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1递归反转:先反转根节点的左子树和右子树 然后再分别反转左子树,右子树各自的下的左子树右子树。依此类推... 阅读全文
posted @ 2015-06-24 12:05 hhrrrr 阅读(183) 评论(0) 推荐(0)
摘要: 非递归: public static int maxDepth(TreeNode root){ if(root==null) return 0; Queue q=new LinkedList(); q.offer(root); int enQu... 阅读全文
posted @ 2015-06-24 11:08 hhrrrr 阅读(164) 评论(0) 推荐(0)
摘要: descriptions:Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.注意是有序数组。。代码:if(num... 阅读全文
posted @ 2015-06-15 20:10 hhrrrr 阅读(118) 评论(0) 推荐(0)
点击右上角即可分享
微信分享提示