
数据结构
庚_
入门学习中,可以但是要给钱。
展开
-
【数据结构】求最大子列和
#include<iostream>#include<vector>using namespace std;int main(){ int n; cin >> n; vector<int>a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } int max = 0; for (int i = 0; i < n; i++) { int sum = 0;原创 2022-03-24 22:59:40 · 110 阅读 · 0 评论 -
【数据结构】输出合并并排序后的序列的中位数
#include<iostream>using namespace std;typedef struct LNode{ LNode* next; int data;}LNode,*Linklist;Linklist InitList(Linklist& L, int n){ int x; L = (Linklist)malloc(sizeof(LNode)); LNode* s, * r = L; for (int i = 0; i < n; i++)原创 2022-03-24 22:58:55 · 379 阅读 · 0 评论 -
【数据结构课程设计】基于商和余数的快速排序
#include<bits/stdc++.h>typedef long long int ll;//ceil() 向上取整//sqrt()平方根const int N = 11100;using namespace std;ll D[N] = { 0 };//待排序数组ll MAX = 0, MIN = N;ll m = 0;//待排序数组的变化范围ll upintm = 0;//m开方向上取整ll kw[N][N] = { 0 };//数组D的下标int p, q;//原创 2022-03-24 22:57:52 · 378 阅读 · 0 评论 -
【数据结构】二分查找
#include<iostream>#include<algorithm>using namespace std;//自己写typedef struct LNode{ LNode *left; LNode *right; int Length; int Element[50];}LNode,*Linklist;int BinartSearch(Linklist Tbl,int k){ int left, right, mid, NoFound = -1;原创 2022-03-24 22:56:39 · 86 阅读 · 0 评论 -
【数据结构】树的遍历,等价中级表达式
等价终极表达式#include <iostream>#include <string>using namespace std;string str;int i;int j=0;int cnt = 0;struct TreeNode{ char value; struct TreeNode* lchild, * rchild; TreeNode(char c) : value(c), lchild(NULL), rchild(NULL) {}原创 2022-03-24 22:55:45 · 102 阅读 · 0 评论 -
【数据结构】单链表删除指定值
【数据结构】单链表删除指定值要求代码要求删除指定值代码#include<iostream>using namespace std;typedef struct LNode{ int data; LNode* next;}LNode, * LinkList;LinkList InitList(LinkList& L,int n){ int x; L = (LinkList)malloc(sizeof(LNode)); LNode* s, * r = L;原创 2022-03-24 22:54:07 · 399 阅读 · 0 评论 -
【数据结构】KMP序号
KMP序号要求代码要求实现KMP序号编码代码#include<iostream>#include<string>using namespace std;const int N = 100;//带空格void GetNext(char ch[], int length, int next[]){ next[1] = 0; int i = 1, j = 0; while (i <= length) { if (j == 0 || ch[i] =原创 2022-03-24 22:50:02 · 325 阅读 · 0 评论