随笔分类 -  Java

摘要:题目: 如果一个链表中包含环,如何找到环的入口节点? 解答: 阅读全文
posted @ 2019-03-03 15:03 林木声 阅读(140) 评论(0) 推荐(0)
摘要:题目: 请输入一个函数,输入一个整数,请输出该数的二进制表示中的1的个数。 解答: 阅读全文
posted @ 2019-03-03 13:21 林木声 阅读(310) 评论(0) 推荐(0)
摘要:题目: 输入两棵二叉树A和B,判断B是不是A的子结构。 解答: 阅读全文
posted @ 2019-03-03 13:07 林木声 阅读(115) 评论(0) 推荐(0)
摘要:题目: 给定一个二叉树和其中一个结点,如何找出中序遍历的下一个结点?树中的节点除了两个分别指向左、右子节点的指针外,还有一个指向父节点的指针。 解答: 阅读全文
posted @ 2019-03-03 12:57 林木声 阅读(116) 评论(0) 推荐(0)
摘要:题目: 输入一个整型数组,判断该数组是不是二叉搜索树的后序遍历结果。 如果是,返回true。否则返回false 解答: 阅读全文
posted @ 2019-03-02 21:01 林木声 阅读(407) 评论(0) 推荐(0)
摘要:题目: 请实现两个函数,分别用来序列化和反序列化二叉树 解答: 阅读全文
posted @ 2019-03-02 20:25 林木声 阅读(207) 评论(0) 推荐(0)
摘要:题目: 输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树。 解答: 阅读全文
posted @ 2019-03-02 19:58 林木声 阅读(89) 评论(0) 推荐(0)
摘要:题目: 请实现一个函数,用来判断一颗二叉树是不是对称的。如果一颗二叉树和它的镜像是一样的,那么它就是对称的。 解答: 阅读全文
posted @ 2019-03-02 17:41 林木声 阅读(129) 评论(0) 推荐(0)
摘要:1 public class Solution { 2 3 public static void MirrorBinaryTree(TreeNode root) { 4 if(root == null) { 5 return; 6 } 7 8 if(root.left == null && roo... 阅读全文
posted @ 2019-03-02 17:31 林木声 阅读(100) 评论(0) 推荐(0)
摘要:死锁? 死锁是指多个进程因竞争资源而造成的一种僵局(互相等待),若无外力作用,这些进程都将无法向前推进。例如,在某一个计算机系统中只有一台打印机和一台输入 设备,进程P1正占用输入设备,同时又提出使用打印机的请求,但此时打印机正被进程P2 所占用,而P2在未释放打印机之前,又提出请求使用正被P1占用 阅读全文
posted @ 2019-03-01 14:38 林木声 阅读(181) 评论(0) 推荐(0)
摘要:对于Object.clone()方法说明 阅读全文
posted @ 2019-03-01 11:38 林木声 阅读(3001) 评论(0) 推荐(0)
摘要:当你把对象加入HashSet时,HashSet会先计算对象的hashcode值来判断对象加入的位置,同时也会和其他加入的对象的hashcode值作比较,如果没有相符的hashcode,HashSet会假设对象没有重复出现,但是如果发现有相同的hashcode值的对象,这时候会调用equals方法来检 阅读全文
posted @ 2019-02-28 14:48 林木声 阅读(1829) 评论(0) 推荐(3)
摘要:执行顺序: 父类 static 子类 static 父类普通代码块 父类 constructor 子类 普通代码块 子类 constructo 阅读全文
posted @ 2019-02-26 16:08 林木声 阅读(202) 评论(0) 推荐(0)
摘要:题目: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in t 阅读全文
posted @ 2019-02-24 15:39 林木声 阅读(324) 评论(0) 推荐(0)
摘要:题目: Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or anothe 阅读全文
posted @ 2019-02-24 15:30 林木声 阅读(135) 评论(0) 推荐(0)
摘要:题目: Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) – Push element x onto stack. pop() – R 阅读全文
posted @ 2019-02-24 15:19 林木声 阅读(119) 评论(0) 推荐(0)
摘要:题目: Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999 解答: 阅读全文
posted @ 2019-02-23 15:49 林木声 阅读(240) 评论(0) 推荐(0)
摘要:题目: Given a matrix of m ✕ n elements (m rows, n columns), return all elements of the matrix in spiral order.For example, given the following matrix:[[ 阅读全文
posted @ 2019-02-23 15:14 林木声 阅读(105) 评论(0) 推荐(0)
摘要:题目: Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example, given the below binary tree,1/ \2 4 阅读全文
posted @ 2019-02-23 14:56 林木声 阅读(107) 评论(0) 推荐(0)
摘要:题目: Given an array where elements are sorted in ascending order, convert it to BST 解答: 阅读全文
posted @ 2019-02-22 16:17 林木声 阅读(136) 评论(0) 推荐(0)