自定义博客皮肤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

为天地立心,为生民立命,为往圣继绝学,为万世开太平

  • 博客(11)
  • 资源 (1)
  • 收藏
  • 关注

转载 骆驼和玉米 [No. 80]

一个骆驮运玉米从A地到B地, 骆驮一次最多运1000个玉米,A地距离B地有1000米远. 而骆驮每走1米就要吃一个玉米.现在有3000个玉米.现在要从A运到B. 问到B地最多还能剩下多少个玉米?wantalcs给出的答案是: class Program{ private static readonly int _maxLoad = 1000; //单次运载上限 pr

2010-07-15 09:21:00 2215

原创 Bubble sort and its implementation

Bubble sort and its implementation.

2010-07-23 07:27:00 799

原创 Selection sort and its implementation

selection sort and its implementation.

2010-07-21 07:20:00 555

原创 Shell sort and its implementation

Shell sort and its implementation

2010-07-21 07:05:00 622

原创 Radix sort

Radix sort and its implementation

2010-07-19 00:42:00 1643

原创 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

2010-07-18 07:38:00 799

原创 快速排序算法递归和非递归实现 [# 29]

Quick sort algorithm is quite like the merge sort, cause both of them use the idea of divide-and-conquer, but be aware, quick sort doesn't conquer it subproblems, cause when the problem is divided int

2010-07-18 04:56:00 889

原创 堆排序(Heap Sort)算法的实现

堆排序算法思想非常简单,先把一个数组看成一个heap, 在下面的实现中,我使用的是max heap, 也就是说根总是比叶子大。所以我们第一步就是建立max heap。建立完毕以后,很明显这个heap的root就是最大的,把最大的根放在数组的最后一个位置,把数组长度缩小一个位置,这样最大的那个数就不会再参与到下次的排序当中,这时,除了根以外,heap的其它部分都保持max heap的特性,所以我们需

2010-07-17 02:07:00 1793

原创 归并排序(Merge sort)算法

Merge sort 算法的思想就是把数组分成更小的数组,合并的时候再排序。由于是二分,所以总的时间为 T(n) = 2 T(n/2) + \theta (n) = O(n * lgn)。public void mergeSort(int[] array, int start, int end) { if (start < end) { int mid = start + (end

2010-07-15 07:07:00 2075

原创 插入排序算法(Insertion Sort)的两种实现

插入排序算法的两种实现。

2010-07-15 04:21:00 4588

原创 二分查找算法(Binary Search)的实现

用二分查找在已排序的数组中查看该数组是否含有一个特定的值是非常快速的,时间复杂度为O(lgn). 二分查找思想很简单,但是实现的时候会在边界条件上出现一些意想不到的问题。 现贴出自己写的程序,供大家参考。第一个实现是基于迭代方式:/// /// implement Binary Search algorithm through iteration approach./// ///

2010-07-15 03:09:00 11869

算法设计与分析 王晓东

算法设计与分析 作者:王晓东 清华大学出版社出版

2010-04-10

空空如也

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

TA关注的人

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