上一页 1 ··· 4 5 6 7 8 9 10 下一页
摘要: 1. 减治法(增量法) 直接插入排序,借鉴了减治法的思想(也有人称之为增量法)。 减治法:对于一个全局的大问题,和一个更小规模的问题建立递推关系。 增量法:基于一个小规模问题的解,和一个更大规模的问题建立递推关系。 可以发现,无论是减治法还是增量法,从本质上来讲,都是基于一种建立递推关系的思想来减小 阅读全文
posted @ 2016-12-12 16:45 Gerrard_Feng 阅读(28857) 评论(1) 推荐(2)
摘要: 问题: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set i 阅读全文
posted @ 2016-12-02 15:46 Gerrard_Feng 阅读(186) 评论(0) 推荐(1)
摘要: 问题: 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-11-28 14:01 Gerrard_Feng 阅读(250) 评论(0) 推荐(0)
摘要: Java 是面向对象的语言,不可避免的,“对象”这个概念是 Java 语言的核心部分,这里来简单讨论一下在 Java 中创建一般对象的方法。 总结下来有以下4种创建对象的方法: 使用 new 关键字调用对象的构造器; 使用 Java 反射的 newInstance() 方法; 使用 Object 类 阅读全文
posted @ 2016-11-16 17:57 Gerrard_Feng 阅读(1278) 评论(0) 推荐(1)
摘要: 问题: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in 阅读全文
posted @ 2016-10-20 14:34 Gerrard_Feng 阅读(225) 评论(0) 推荐(1)
摘要: 问题: Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, and n = 2. After 阅读全文
posted @ 2016-10-19 15:10 Gerrard_Feng 阅读(243) 评论(0) 推荐(1)
摘要: 问题: Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array 阅读全文
posted @ 2016-10-18 15:16 Gerrard_Feng 阅读(232) 评论(0) 推荐(1)
摘要: 问题: Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the tele 阅读全文
posted @ 2016-10-17 11:12 Gerrard_Feng 阅读(348) 评论(0) 推荐(1)
摘要: 问题: 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 intege 阅读全文
posted @ 2016-10-14 10:25 Gerrard_Feng 阅读(204) 评论(0) 推荐(1)
摘要: 和冒泡排序一样,选择排序也是蛮力法的一种实际应用。 选择排序的思想,就是首先扫描整个数组,找到最小的元素,然后和第一个元素进行交换,如此一来就等同于将最小的元素放到它在有序表中最终的位置上。然后从第二个元素开始扫描整个表,找到剩余n-1个元素中最小的元素,与第二个元素交换位置。以此类推,在执行n-1 阅读全文
posted @ 2016-10-13 15:36 Gerrard_Feng 阅读(1428) 评论(0) 推荐(2)
上一页 1 ··· 4 5 6 7 8 9 10 下一页