08 2016 档案

摘要:1 类 1)在java中,类文件是以.java为后缀的文件,若.java文件中存在public类,则文件名必须与public的类名一致。否则,文件名随意。 2)类中的成员变量若没有被显式地赋值初始化,java会保证每个成员变量得到合适的初始化。 a)基本数据类型:byte, short, int, 阅读全文
posted @ 2016-08-20 20:18 江湖凶险
摘要:HashSet\HashMap\HashTable 1 基于散列的集合 2 元素会根据hashcode散列,因此,集合中元素的顺序不一定与插入的顺序一致。 3 根据equals方法与hashCode方法判断元素是否相等。这两个方法是从Object基类中继承的, 查看Object源码,若比较两个引用变 阅读全文
posted @ 2016-08-17 21:26 江湖凶险 阅读(364) 评论(0) 推荐(0)
摘要:一、邮件格式 Hi Jack, (打招呼,用Hi就可以) Could you please help to create user IDs with below info? (礼貌用语,could you please....) Thank you for your help. (致谢) Best 阅读全文
posted @ 2016-08-15 17:46 江湖凶险 阅读(1106) 评论(0) 推荐(0)
摘要:如何发起一段对话? 1 Hi. 见面打招呼使用Hi就显得比较随和,也不失正式。 2 How are you today?或 How is it going? 3 Fine. What about you? 你呢 4 Where are you from? 你来自哪里的最地道的表述。 5 I am C 阅读全文
posted @ 2016-08-15 17:07 江湖凶险 阅读(490) 评论(0) 推荐(0)
摘要:问题描述: * 给定一个整数数组a,长度为N,元素取值范围为[1,N]。 * 统计各个元素出现的次数,要求时间复杂度为O(N),空间复杂度为O(1)。 * 可以改变原来数组结构。 思路: * 从第一个元素开始遍历,每遍历到一个元素,将(该元素值 - 1 记为index)作为一个下标值,令该下标对应的 阅读全文
posted @ 2016-08-13 21:37 江湖凶险 阅读(7041) 评论(0) 推荐(0)
摘要:题目:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 解析:合并k个已经有序的单链表,使其最终成为一个有序的单链表。原理就是归并排序,递归运算。基本算 阅读全文
posted @ 2016-08-13 21:23 江湖凶险 阅读(455) 评论(0) 推荐(0)
摘要:题目:Sort a linked list in O(n log n) time using constant space complexity. 分析:给单链表排序,要求时间复杂度是O(nlogn),空间复杂度是O(1)。时间复杂度为O(nlogn)的排序算法有快速排序和归并排序, 但是,对于单链 阅读全文
posted @ 2016-08-13 20:32 江湖凶险 阅读(790) 评论(0) 推荐(0)
摘要:题目: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. 分析:合 阅读全文
posted @ 2016-08-13 19:53 江湖凶险 阅读(752) 评论(0) 推荐(0)
摘要:题目: Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. 解析:同求全部组合的过程一样,只是这里限制每个组合中元素的个数为k,求所有组合时并不限制元素个数。 若要排除重复 阅读全文
posted @ 2016-08-13 16:18 江湖凶险 阅读(608) 评论(0) 推荐(0)
摘要:解析: 一:非字典序(回溯法) 1)将第一个元素依次与所有元素进行交换; 2)交换后,可看作两部分:第一个元素及其后面的元素; 3)后面的元素又可以看作一个待排列的数组,递归,当剩余的部分只剩一个元素时,得到一个排列; 4)将第1步中交换的元素还原,再与下一个位元素交换。 重复以上4步骤,直到交换到 阅读全文
posted @ 2016-08-13 11:59 江湖凶险 阅读(236) 评论(0) 推荐(0)
摘要:题目: Shuffle a set of numbers without duplicates. 分析: 对一组不包含重复元素的数组进行随机重排,reset方法返回最原始的数组,shuffle方法随机返回数组的一个排列, 并且使得获得数组每一个排列的概率都是相同的。为此,可以在初始化时,求出数组的所 阅读全文
posted @ 2016-08-12 14:21 江湖凶险 阅读(1873) 评论(0) 推荐(0)
摘要:题目: You are given two integer arrays nums1 and nums2 sorted in ascending order and an integer k. Define a pair (u,v) which consists of one element fro 阅读全文
posted @ 2016-08-12 11:42 江湖凶险 阅读(235) 评论(0) 推荐(0)
摘要:题目: Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix. Example: 分析:采用 阅读全文
posted @ 2016-08-12 10:28 江湖凶险 阅读(868) 评论(0) 推荐(0)
摘要:1 在各自最优的条件下,下面哪些算法性能最优(B) A 快速排序 B 冒泡排序 C 直接插入排序 D 简单选择排序 2 设计分布式写文件,读文件,并编程实现。 3 java多线程编程(淘宝 买家付款给中间账户,在买家确认收货后,中间账户再转账给卖家)淘宝每天有10万笔这样的交易,请用多线程实现。 4 阅读全文
posted @ 2016-08-10 20:38 江湖凶险 阅读(308) 评论(0) 推荐(0)
摘要:一、项目 1、Spring MVC与Struts2的区别: 2、MVC三层是如何工作的?比如:要访问一个Url?a=xx&b=xx,怎么找到相应的资源,怎么运算,怎么返回等? 3、数据库mybatis,如何优化的?加索引。 二、计算机网络 1、Http协议中GET与POST的区别 a) GET请求的 阅读全文
posted @ 2016-08-04 13:55 江湖凶险 阅读(1086) 评论(0) 推荐(0)