![](https://img-blog.csdnimg.cn/20200213165426521.jpg?x-oss-process=image/resize,m_fixed,h_224,w_224)
算法导论
A beginner's leaning path
Rookie’Program
这个作者很懒,什么都没留下…
展开
-
[算法导论]矩阵链乘法
#include<stdio.h>#include<iostream>#include<limits>using namespace std;const int Rows = 3;const int Columns = 2;int c[Rows][Rows];const int N = 6;//矩阵个数void MatrixMultipl...原创 2018-03-20 22:36:04 · 259 阅读 · 0 评论 -
[算法导论]最大子数组问题
#include<stdio.h>#include<iostream>#include<limits>using namespace std;#define Length 16void MaxSubArray1(int num[], int length);int MaxSubArray2(int num[], int low, int hig...原创 2018-03-18 07:47:02 · 198 阅读 · 0 评论 -
[算法导论]矩阵乘法的Strassen算法
#include<stdio.h>#include<iostream>using namespace std;#define Length 3int * MatrixMultiply(int numa[][Length], int numb[2][Length], int n);//直接计算 //void MatrixMultiplyRecursive(i...原创 2018-03-18 07:47:13 · 452 阅读 · 0 评论 -
[算法导论]钢材切割
#include<stdio.h>#include<iostream>#include<limits.h>using namespace std;const int Length = 10;int s[Length + 1] = {0}, r[Length + 1] = {0};int Max(int a, int b);int C...原创 2018-03-18 07:47:30 · 1278 阅读 · 0 评论 -
[算法导论]小递归
#include<stdio.h>void Reverse();int aM1(int x);int aM2(int x);float bM(int n, float x);float cM1(int n, int x);float cM2(int n, int x);int main (){ printf("以'.'为终止 倒叙打印\n"); //...原创 2018-03-18 07:47:49 · 200 阅读 · 0 评论 -
[算法导论]汉诺塔(两种递归结束条件)
#include<stdio.h>#include<iostream>using namespace std;void HanoiRecursion1(int n, char a, char b, char c);//两种递归的结束条件不同void HanoiRecursion2(int n, char a, char b, char c);int mai...原创 2018-03-18 07:47:39 · 405 阅读 · 0 评论 -
[算法导论]红黑树
#include<stdio.h>#include<iostream>#include<stdlib.h>using namespace std;enum Color{RED, BLACK};const int Length = 10;typedef struct RB{ int key; RB *parent; RB *left;...原创 2018-03-18 07:47:59 · 175 阅读 · 0 评论 -
[算法导论]二叉排序树
#include<stdio.h>#include<iostream>#include<stdlib.h>using namespace std;#define Length 10typedef struct Tree{ Tree * p; Tree * left; Tree * right; int key;}*TreeList...原创 2018-03-17 13:04:27 · 298 阅读 · 1 评论 -
[算法导论]二分查找
#include<stdio.h>#include<iostream>using namespace std;#define Length 8int BinarySearch1(int num[], int head, int rear, int key);//二分查找(递归) int BinarySearch2(int num[], int hea...原创 2018-03-17 13:02:13 · 435 阅读 · 0 评论 -
[算法导论]中位数和顺序统计量
#include<stdio.h>#include<iostream>using namespace std;const int Length = 10; void MinAndMax(int num[], int len);int main (){ int num[Length] = {12, 2, 34, 56, 26, 8, 31...原创 2018-03-17 13:01:10 · 316 阅读 · 0 评论 -
[算法导论]散列表
#include<stdio.h>#include<iostream>#include<stdlib.h>using namespace std;const int Length = 6;//待插入的数列长度 const int TableSize = 11;//哈希表的容量 应该打大于数列长度以保证每个元素都有处可放 ty...原创 2018-03-17 12:52:27 · 258 阅读 · 0 评论 -
[算法导论]优先队列(基于堆排序)
#include<stdio.h>#include<iostream>using namespace std;#define Length 10void MaxHeapify(int num[], int i, int len);//堆调整 void BuildHeap(int num[], int len);//建立初始最大队 int Heap...原创 2018-03-17 12:50:53 · 235 阅读 · 0 评论 -
[算法导论]基数排序
#include<stdio.h>#include<iostream>#include<cmath>#define Length 10using namespace std;void CountSort(int numa[], int len, int range, int d);//参数: 带排序数组 数组长度 数组中元素从0到最...原创 2018-03-17 12:47:29 · 344 阅读 · 0 评论 -
[算法导论]桶排序
//自创的桶排序算法 #include<stdio.h>#include<iostream>#define Length 10using namespace std;void BucketSort(int num[], int range, int len);//待排数组 range:待排元素的低位可能的取值范围 待排数组的长度 void Inse...原创 2018-03-17 12:45:58 · 265 阅读 · 0 评论 -
[算法导论]计数排序
#include<stdio.h>#include<iostream>#define Length 8using namespace std;void CountSort(int numa[], int numb[], int len, int range);void Output(int num[], int len);int main ()...原创 2018-03-17 12:44:49 · 221 阅读 · 0 评论 -
[算法导论]堆排序
#include<stdio.h>#include<iostream>using namespace std;#define Length 10void MaxHeapify(int num[], int i, int len);void BuildHeap(int num[], int len);int Heapsort(int num[],...原创 2018-03-17 12:43:13 · 201 阅读 · 0 评论 -
[算法导论]基本排序
#include<stdio.h>#include<iostream>using namespace std;#define Length 10void Insertsort(int num[], int length); //插入排序void Mergesort(int num[], int low, int high); //归并排序 vo...原创 2018-03-17 12:40:35 · 206 阅读 · 0 评论