
数据结构
计算机集成_
大厂软件工程师-关注一起变优秀/公众号:计算机集成
展开
-
最大子序列和问题
求给定N个整数的序列{A1,A2,……,An},求函数 f(i,j)=max{0,∑(i→j)Ak}的最大值 算法1 直接暴力求出每个子序列和的值,然后取最大的值。时间复杂度为O(n^3) int MaxSubseqSum1(int A[], int N) { int ThisSum, MaxSum = 0; int i, j, k; for (i = 0; i < N; i ...原创 2020-02-06 13:42:35 · 488 阅读 · 0 评论 -
折半查找
#include <iostream> #include <malloc.h> using namespace std; #define MAXL 100 typedef int KeyType; typedef char InfoType; typedef struct { KeyType key;//关键字 InfoType data;//其他数据项 }Rec...原创 2019-11-21 12:08:47 · 165 阅读 · 0 评论 -
顺序查找
#include <iostream> #include <malloc.h> using namespace std; #define MAXL 100 typedef int KeyType; typedef char InfoType; typedef struct { KeyType key;//关键字 InfoType data;//其他数据项 }Rec...原创 2019-11-21 12:06:39 · 247 阅读 · 0 评论 -
分块查找
#include <iostream> #include <malloc.h> using namespace std; #define MAXL 100 #define MAXI 20 typedef int KeyType; typedef char InfoType; typedef struct { KeyType key;//关键字 InfoType d...原创 2019-11-21 12:05:11 · 132 阅读 · 0 评论