文章分类 - 算法学习
摘要:package com.pigetest.util.leet.code; public class Find2rdMaxNumber { public static int find2rdMaxNumber(int[]num){ int max=Integer.MIN_VALUE; int secondMax=Integer.MIN_VALUE; ...
阅读全文
摘要:后序遍历 基本思想:如果这两个节点不在一条线上(即这两个节点不存在一个节点是另一个节点的祖先的情况),则它们必定分别在所求节点A的左子树和右子树上,后序遍历到第一个满足这个条件的节点就是所要求的节点A。否则,当这两个节点在一条线上,所求节点A则是这两个节点中深度最低的节点的父节点。
阅读全文
摘要:1、八个数找到第二大的数 2、判断是否为完全二叉树 3、高并发相关 4、长连接和短连接之间的关系 5、 在服务框架下,怎么实现client的异步请求 6、mysql分库分表 7、mysql慢查询 8、输入一个url,到页面加载完成都使用了哪些协议? 9、旋转数组的二分查找 10、设计一个可扩展的序列
阅读全文
posted @ 2016-07-26 00:40
程序猿进化之路
摘要:转载:http://www.cnblogs.com/yskcoder/p/4560311.html 在使用mybatis 时我们sql是写在xml 映射文件中,如果写的sql中有一些特殊的字符的话,在解析xml文件的时候会被转义,但我们不希望他被转义,所以我们要使用<![CDATA[ ]]>来解决。
阅读全文
摘要:归并排序的时间复杂度为o(nlogn),但它很难用于主存排序,主要问题碍于合并两个排序的表需要使用线性附加内存,在整个算法中还要花费将数据拷贝到临时数组,在将临时数组的数据拷贝到原来的数组,其操作严重放慢了排序的速度
阅读全文
摘要:http://blog.csdn.net/morewindows/article/details/6709644/
阅读全文
摘要:package leetcode.heap; /** * 小顶堆(即根节点小于或等于左右子树的值,且左右子树也为小顶堆) * 堆是满二叉树,有特殊的性质 * * 1、对于节点在i的元素,其左儿子在位置2i上,右儿子的2i+1上 * 2、父亲节点在i/2向下取整的位置上 * * * @author li * */ public class MinHeap { ...
阅读全文
摘要:二叉搜索树是左子树的所有值都小于根节点,右子树的所有值都大于根节点的值
阅读全文
摘要:1、Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For e
阅读全文
摘要:Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. The same repeat
阅读全文
摘要:Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers.
阅读全文
摘要:http://blog.csdn.net/feliciafay/article/details/6841115
阅读全文
摘要:Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space for a...
阅读全文
摘要:Remove all elements from a linked list of integers that have valueval.ExampleGiven:1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6,val= 6Return:1 --> 2 --> 3 --...
阅读全文
摘要:package eleven;import java.util.Random;public class QuickSort { /** * 快速排序 * * @param num * @param left * @param right * @...
阅读全文
摘要:Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".package leetcode;public class ...
阅读全文
摘要:package eleven;/** * 插入排序 * * @author li * */public class InsertSort { /** * * @param num * 带排序数组 * @return */ ...
阅读全文
摘要:Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321click to show spoilers.Subscribeto see which companies asked th...
阅读全文
摘要:编写一个banner函数,该函数的输入为大写字母,输出为一个字符数组,该数组以图形化的方式表示该字母package third;import java.awt.Color;import java.awt.Font;import java.awt.FontMetrics;import java.awt...
阅读全文
摘要:计算税率表达式简化 1 package third; 2 3 public class SimpleTax { 4 public static double getTax(double income) { 5 double index = (income - 2200) /...
阅读全文

浙公网安备 33010602011771号