自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Yuwen's Hero

专注面试题, 博客 http://blog.csdn.net/beiyeqingteng 的镜像站

  • 博客(4)
  • 收藏
  • 关注

原创 Counting sort

The running time of counting sort  is O(n), and usually, the running time of sorting algorithms will be either O(n^2) or O(n lgn), the reason why counting sort is O(n) is that it doesn't have the comp

2013-03-27 07:12:04 676

原创 Trie + recursion + pruning to implement Boggle

If you want to know what Boggle is, please wiki or google it. Or refer to http://goo.gl/GythQ  In this implementation, we need to use a dictionary. Go to http://goo.gl/vaq4Z to download it and as it

2013-03-18 04:00:10 1400

原创 数组中找出第k大的值

最简单的办法,就是先排序,然后把第K个值找出来,这样算法的复杂度为 O(nlgn). 其实还有一种更简单的方法,其平均复杂度 为 O(lgn),当然,最坏是 O(n^2). 这种算法就是利用了 quicksort 和二分查找 的做法。先把数组分成两个部分,左边一个部分比pivot小,另一边比pivot大。然后再观察pivot的位置,如果pivot的位置比 K大,那么那个第K个值就一定在pivot

2013-03-13 23:48:31 1212

原创 快速找出2到n所有的素数

public static ArrayList primeNumbers(int n) { if (n < 2) return null; ArrayList list = new ArrayList(); boolean[] prime = new boolean[n + 1]; for (int i = 2; i < n + 1; i++) { prime[i] = tr

2013-03-11 12:29:40 2628

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除