- 博客(8)
- 资源 (1)
- 收藏
- 关注
原创 Broken Keyboard
On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys will not appear on screen. Now given a string that you are suppose
2015-05-28 22:43:04
415
原创 quick sort 简单C++实现
// algorithms.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "iostream" using std::cout; using std::endl; void quickSort(int *a, int start, int end); int
2015-05-12 16:29:24
603
原创 基于算法导论6.5用最大堆实现的优先队列(C++)
// algorithms.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "iostream" using std::cout; using std::endl; int heapSize; const int arraySize = 10; void maxH
2015-05-07 15:59:38
498
原创 c++实现简单的建堆、维护堆和堆排序
// algorithms.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "iostream" using std::cout; using std::endl; int heapSize; void maxHeapIFY(int *,int); void b
2015-05-06 12:32:31
1135
原创 最大堆维护,MAX-HEAPIFY非递归伪代码
MAX-HEAPIFY(A,i) l = LEFT(I) r = RIGHT(i) if lA[i] largest = l; else largest = i; if rA[largest] largest = r while(largest!=i) exchange A[i] and A[largest] i = largest l = LEFT(i)
2015-04-29 09:53:53
934
原创 算法导论4.1-3~4.1-5最大子数组暴力算法和递归算法的实现和线性时间算法实现
第三章看了由于数学基础不是太好,看的似懂非懂,有点模糊,就跳过去了。等有时间了好好学下数学,然后重头再看一遍。以下是最大子数组的递归算法和暴力算法的C++实现,递归算法是按着伪代码写的 #include "stdafx.h" #include using namespace std; int findMaxCorssingSubarray(int a[], int low, int
2015-04-15 15:33:33
1234
原创 插入排序的递归实现和二分查找递归实现,算法导论2.3-4和2.3-5
while语句的时候写成 while(i>=0 && i>key) 没注意, 还纳闷死了,怎么会错。 #include "stdafx.h" #include using namespace std; void reInsertSort(int a[], int length); bool diFind(int a[],int begin,int end,int val); int
2015-04-15 09:49:04
985
原创 算法导论第二章mergesort的C++ 实现
之前在merge这段函数 for (int k = p; k 没给r+1 导致最后输出的结果不正确
2015-04-14 16:55:49
633
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅