![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构
分享数据结构和相关c代码,供大家参考
Mr.Ma-master
已工作,暂时不考虑更新了。。
展开
-
数据结构:串的匹配2(C++代码实现)
#include<iostream> using namespace std; struct String { char s[100]; }; int Index(String S,String T,int pos){ int i=pos;int j=1;int n,m; n=strlen(S.s); m=strlen(T.s); while(i<=n&&j&l...原创 2020-04-20 16:50:39 · 305 阅读 · 0 评论 -
数据结构:快速排序问题(C++实现代码)
#include<iostream> using namespace std; void quickSort(int A[],int,int); int main() { int A[]={49,38,65,97,76,13,27,50},i; int len=sizeof(A)/sizeof(int); cout<<"这...原创 2020-04-20 16:46:58 · 402 阅读 · 0 评论 -
数据结构:实现串的模式匹配算法(c++代码实现)
程序代码: #include<iostream> using namespace std; struct String{ char s[200]; }; int Index(String S,String T,int pos){ int i=pos;int j=1;int n,m; n=strlen(S.s); m=strlen(T.s); while(i<=n&&am...原创 2020-04-20 16:37:57 · 1463 阅读 · 0 评论 -
数据结构:链表(c++代码实现)
#include<iostream> using namespace std; typedef int ElemType; struct NodeType { ElemType data; NodeType *next; }; class LinkList { private: NodeType *Head; public: LinkList(); ~Lin...原创 2020-04-20 16:29:21 · 411 阅读 · 0 评论 -
数据结构:折半查找(c++代码实现)
#include<iostream> using namespace std; int Bisearch(int data[],int x,int low ,int high) { if(low>high) { return -1; exit(0); } int mid=(low+high)/2; if (x == data[mid]) { re...原创 2020-04-20 16:25:28 · 2805 阅读 · 0 评论 -
数据结构:最大字段和问题-分治思想(c++代码实现)
#include<iostream> using namespace std; #define N 6 int a[N]={-2,11,-4,13,-5,-2}; int MaxSum(int n, int *a) { int sum=0, b=0; for( int i=1;i<=n;i++) { if(b>0) b+=a[i...原创 2020-04-20 16:23:00 · 609 阅读 · 0 评论 -
数据结构:最大最小元素问题(C++代码实现)
#include<iostream.h> void main() { int A[]={3,5,1,8,6,10,56,21,11,2}; int min,max; min=max=A[0]; for(int i=0; i<10; i++) { if(A[i]>max) max=A[i]; if(A[i]&...原创 2020-04-20 16:18:50 · 328 阅读 · 0 评论 -
数据结构:图的最短路径(C++代码实现)
#include <iostream> using namespace std; const int max=9999; void minpath(int v,int n,int d[100],int pre[100],int c[100][100]) { int s[100]; for(int i=1;i<=n;i++) { d[i]=c[v][i];...原创 2020-04-20 16:12:12 · 2338 阅读 · 1 评论