www

导航

02 2019 档案

二叉搜索树与双向链表
摘要: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 阅读(97) 评论(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 阅读(158) 评论(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 阅读(95) 评论(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 阅读(215) 评论(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 阅读(134) 评论(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 阅读(137) 评论(0) 推荐(0)

数据库(脏读,不可重复读,幻读)
摘要:脏读:(Read committed) 不可重复读:(Repeatable read) 幻读:(Serializable) 阅读全文

posted @ 2019-02-27 17:12 www_practice 阅读(1668) 评论(0) 推荐(0)

HTTP请求方法
摘要:【GET】从指定的资源请求数据 【POST:传输实体文本】 GET方法和POST方法本质上的区别: 1、GET方法用于信息获取,它是安全的(安全:指非修改信息,如数据库方面的信息),而POST方法是用于修改服务器上资源的请求; 2、GET请求的数据会附在URL之后,而POST方法提交的数据则放置在H 阅读全文

posted @ 2019-02-27 11:46 www_practice 阅读(223) 评论(0) 推荐(0)

TCP协议
摘要:TCP-流量控制 所谓的流量控制就是让发送方的发送速率不要太快,让接收方来得及接受。利用滑动窗口机制可以很方便的在TCP连接上实现对发送方的流量控制。TCP的窗口单位是字节,不是报文段,发送方的发送窗口不能超过接收方给出的接收窗口的数值。 TCP-拥塞控制 慢开始和拥塞避免 发送报文段速率的确定,既 阅读全文

posted @ 2019-02-27 10:46 www_practice 阅读(218) 评论(0) 推荐(0)

Mysql的两种引擎
摘要:Innodb引擎: 1.Innodb引擎提供了对数据库ACID事务的支持,并且实现了SQL标准的四种隔离级别 2.该引擎还提供了行级锁和外键约束,它的设计目标是处理大容量数据库系统,它本身其实就是基于MySQL后台的完整数据库系统 3.MySQL运行时Innodb会在内存中建立缓冲池,用于缓冲数据和 阅读全文

posted @ 2019-02-27 10:28 www_practice 阅读(158) 评论(0) 推荐(0)

CDN是如何工作的?
摘要:CDN的原理非常简单。当浏览器请求一资源时,第一步是做DNS解析,DNS解析就像是从通讯录根据姓名找号码,浏览器发送域名,然后得到DNS服务器返回的IP地址。浏览器通过IP地址和服务器连接并获取资源(DNS服务器会有很多层的缓存,但超出本文范围)。 对于小站点或个人博客,一个域名对应一个IP地址,而 阅读全文

posted @ 2019-02-27 09:56 www_practice 阅读(442) 评论(0) 推荐(0)

Java线程池
摘要:ThreadPoolExecutor ThreadPoolExecutor#execute(Runnable command); public void execute(Runnable command) { if (command == null) throw new NullPointerExc 阅读全文

posted @ 2019-02-27 09:34 www_practice 阅读(136) 评论(0) 推荐(0)

在浏览器地址栏输入一个URL后回车,背后会进行哪些技术步骤?
摘要:打开浏览器,输入http://zhihu.com敲回车键。 第一步是浏览器对用户输入的网址做初步的格式化检查,只有通过以上检查才会进入下一步。(如果小明输入的是 “zhi hu.com” 或 “zhi@hu.com1”, 这些网址都是非法无效的,浏览器就要拒绝小明的无理要求,提示小明出错了)浏览器是 阅读全文

posted @ 2019-02-27 08:42 www_practice 阅读(395) 评论(0) 推荐(0)

二叉树中和为某一值的路径
摘要:public class Solution { ArrayList> res = new ArrayList(); ArrayList path = new ArrayList(); public ArrayList> FindPath(TreeNode root,int target) { if (root == null) { ... 阅读全文

posted @ 2019-02-26 22:59 www_practice 阅读(139) 评论(0) 推荐(0)

tcp面试题
摘要:常见面试题【问题1】为什么连接的时候是三次握手,关闭的时候却是四次握手? 答:因为当Server端收到Client端的SYN连接请求报文后,可以直接发送SYN+ACK报文。其中ACK报文是用来应答的,SYN报文是用来同步的。但是关闭连接时,当Server端收到FIN报文时,很可能并不会立即关闭SOC 阅读全文

posted @ 2019-02-26 20:42 www_practice 阅读(472) 评论(0) 推荐(0)

从上往下打印二叉树
摘要:public ArrayList PrintFromTopToBottom(TreeNode root) { ArrayList ret = new ArrayList(); if(root==null) return ret; Queue queue = new LinkedList(); queue.offer(root); while(queue.s... 阅读全文

posted @ 2019-02-25 23:20 www_practice 阅读(133) 评论(0) 推荐(0)

合并两个排序链表
摘要:public ListNode Merge(ListNode list1,ListNode list2) { if(list1==null) return list2; if(list2==null) return list1; ListNode head=new ListNode(0); ListNode current = head; ... 阅读全文

posted @ 2019-02-25 22:58 www_practice 阅读(110) 评论(0) 推荐(0)

反转链表
摘要:public ListNode ReverseList(ListNode head) { if(head==null||head.next==null) return head; ListNode pReverseHead=null; ListNode pNode=head; ListNode pPrev=null; while... 阅读全文

posted @ 2019-02-25 21:06 www_practice 阅读(169) 评论(0) 推荐(0)

二进制中1的个数
摘要:public int NumberOf1(int n) { int count = 0; while (n!=0) { n = n&(n-1); count++; } return count; } 阅读全文

posted @ 2019-02-25 20:47 www_practice 阅读(99) 评论(0) 推荐(0)

链表中倒数第k个结点
摘要:public ListNode FindKthToTail(ListNode head,int k) { if(head==null) return head; ListNode pre=head; ListNode last=head; for(int i=0; i<k; i++){ if(last==null) return null; ... 阅读全文

posted @ 2019-02-25 20:45 www_practice 阅读(132) 评论(0) 推荐(0)

调整数组顺序使奇数位于偶数前面
摘要:public void reOrderArray(int [] array) { if(array==null||array.length==0) return; int start=0, end=array.length-1; while(startstart&&array[end]%2!=0) end--; if(start<end){ ... 阅读全文

posted @ 2019-02-25 19:22 www_practice 阅读(136) 评论(0) 推荐(0)

重建二叉树
摘要:public TreeNode reConstructBinaryTree(int [] pre,int [] in) { if(pre==null||in==null||pre.length!=in.length||pre.lengthpe || is>ie) return null; int val = pre[ps]; int ind... 阅读全文

posted @ 2019-02-25 19:10 www_practice 阅读(131) 评论(0) 推荐(0)

旋转数组的最小数字
摘要:public int minNumberInRotateArray(int [] array) { if(array==null||array.length==0) return -1; int start=0, end=array.length-1; int mid=start; while(array[start]>=arra... 阅读全文

posted @ 2019-02-25 18:59 www_practice 阅读(147) 评论(0) 推荐(0)

MergeKLists
摘要:public ListNode mergeKLists(ListNode[] lists) { if(lists==null||lists.length==0) return null; PriorityQueue minHeap=new PriorityQueue((o1, o1)->{ return o1.val-o2.val; ... 阅读全文

posted @ 2019-02-25 18:51 www_practice 阅读(175) 评论(0) 推荐(0)

Top K Frequent Elements
摘要:public List topKFrequent(int[] nums, int k){ List ret = new ArrayList(); if (nums==null || nums.length map = new HashMap(); for (int n:nums) map.put(n,map.getOrDefault(n,0)+1)... 阅读全文

posted @ 2019-02-25 18:23 www_practice 阅读(128) 评论(0) 推荐(0)

旋转数组的最小数字
摘要:private int minNumberInRotateArray(int [] array) { if (array == null || array.length == 0) { throw new RuntimeException("input is invalid"); } int index1 = 0;... 阅读全文

posted @ 2019-02-16 18:22 www_practice 阅读(134) 评论(0) 推荐(0)

BinarySearch(Java)
摘要:1 private int binarySearch(int[] input, int target) { 2 if (input == null) { 3 return -1; 4 } 5 6 int index1 = 0; 7 int index2 = input.length-1... 阅读全文

posted @ 2019-02-16 17:44 www_practice 阅读(146) 评论(0) 推荐(0)

QuickSort(Java)
摘要:1 private void quickSort(int[] input, int start, int end) { 2 if (start >= end) return; 3 4 int index = partition(input, start, end); 5 6 if (index > start) { 7 ... 阅读全文

posted @ 2019-02-16 17:32 www_practice 阅读(171) 评论(0) 推荐(0)