自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(11)
  • 收藏
  • 关注

原创 《剑指Offer》— Java版(Problem 41 - 45)

Problem 41:数据流中的中位数PriorityQueue<Integer> minHeap = new PriorityQueue();PriorityQueue<Integer> maxHeap = new PriorityQueue(new Comparator<Integer>(){ @Override public int compare...

2019-06-29 23:22:15 156

原创 《剑指Offer》— Java版(Problem 36 - 40)

Problem 36:二叉搜索树转双向链表TreeNode head = null;TreeNode pre = null;public TreeNode convert(TreeNode root){ inOrder(root); return head;}public void inOrder(TreeNode node){ if(node == null) return ;...

2019-06-29 15:02:20 128

原创 《剑指Offer》— Java版(Problem 31 - 35)

Problem 31:栈的压入、弹出序列public boolean isPopOrder(int[] pushA, int[] popA){ if(pushA == null || popA == null) return false; Stack<Integer> stack = new Stack(); for(int pushIndex = 0, popIndex = ...

2019-06-27 21:50:44 137

原创 《剑指Offer》— Java版(Problem 26 - 30)

Problem 26:树的子结构 public boolean hasSubTree(TreeNode root1, TreeNode root2) { if(root1 == null || root2 == null) return false; return isSubTree(root1,root2) || isSubTree(roo1.left,root2) || isSub...

2019-06-27 21:22:27 122

原创 《剑指Offer》— Java版(Problem 21 - 25)

Problem 21:调整数组顺序使奇数位于偶数前面使用冒泡排序,将偶数沉底 public double Reorder(int[] arr) { for(int i = 0; i < arr.length - 1; i++) for(int j = 0;j < arr.length - 1 - i; j++) if(isEven(arr[j]) &amp...

2019-06-27 21:03:52 109

原创 Java 利用栈进行非递归二叉树遍历

前序遍历借助一个栈,先把根节点压入,当栈不为空是弹栈,依次判断节点有没有右孩子和左孩子,有就压入。因为前序遍历顺序是根左右,所以右孩子要比左孩子先压入栈中。 public static void pre(TreeNode head) { if(head != null) { Stack<TreeNode> s = new Stack(); s.push(head);...

2019-06-23 19:54:23 858

原创 《剑指Offer》— Java版(Problem 16 - 20)

Problem 16:数值的整数次方 public double Power(double base, int exponent) { if(exponent == 0) return 1; if(exponent == 1) return base; boolean isNegative = false; if(exponent < 0) { ...

2019-06-18 19:40:17 122

原创 《剑指Offer》— Java版(Problem 11 - 15)

Problem 11:旋转数组的最小数字利用二分查找 public int minNumberInRotateArray(int[] arr) { if(arr == null || arr.length == 0) return 0; int low = 0; int high = arr.length - 1; while(low <= high) ...

2019-06-18 15:28:37 107

原创 《剑指Offer》— Java版(Problem 6 - 10)

Problem 6:从尾到头打印一个链表 public static String replaceSpace(StringBuffer str) { int p = str.length() - 1; for(int i = 0; i <= p; i++) if(str.charAt(i) == ' ') str.append(" "); int q = str...

2019-06-17 22:25:31 142

原创 《剑指Offer》— Java版(Problem 2 - 5)

每个问题开头都应该注意空引用等其他问题,增强代码鲁棒性Problem 2:实现Singleton模式Java中有6种实现方法实现Singleton模式,有不同的特点//饿汉式(效率低)Class Single{ private static Single s = new Single(); private Single(){} public static Single getInst...

2019-06-17 21:35:00 126

转载 Eclipse Push 到 Github 时出现 rejected - non-fast-forward 错误

https://www.cnblogs.com/AryaZ/archive/2017/10/14/7668133.html

2019-06-15 15:52:23 332

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除