算法
文章平均质量分 55
monster1935
千里之行,始于足下。我的万里长征路还很长,不能放弃!
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
对公司员工年龄进行排序,java实现
要求:对公司的员工年龄进行排序,员工人数大约万名左右,可使用常量大小的辅助空间,要求时间效率为O(n)。 实现思路:使用一个额外的辅助数组用来记录同龄的员工数目。 实现如下: public static void sort(int []ages){ int oldestAge=100; int []timesOfAges=new int[oldestAge]; int le原创 2016-04-17 16:58:31 · 1673 阅读 · 0 评论 -
LeetCode||add Two Numbers
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link翻译 2015-04-24 21:05:09 · 328 阅读 · 0 评论 -
leetCode||two sum
思路1:使用直接排序思路,使用双层循环遍历数组, for(int i=0;i { for(int j=i+1;j { //进行判断操作, if(numbers[i]+numbers[j]==target) ... } } 很显然这种思路可以完成题目的目的,能实现给出一固定整数,在数组中找出两个数字相加等于该数字的功能。并返回这两个数字的索引+1.但是这种思路有一种明显的弊端,即原创 2015-04-17 16:09:23 · 247 阅读 · 0 评论 -
Java语言中链表的创建、遍历、逆置
Java语言中链表的创建、遍历、逆置 class ListNode { int val; ListNode next; } public class testListNode { /** * 1.链表的创建 * 2.链表的遍历 * 3.链表的逆置 * * */ public static void main(String[] args) { Lis原创 2015-04-24 19:46:01 · 1455 阅读 · 0 评论
分享