上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 38 下一页
摘要: #include <iostream> using namespace std; int main(int argc, const char *argv[]) { int n, k; int h[100000]; int w[100000]; cin >> n >> k; for (int i = 阅读全文
posted @ 2023-12-06 16:41 涨涨涨张 阅读(10) 评论(0) 推荐(0)
摘要: 哈夫曼树哈夫曼编码 输入一组整型权值,构建哈夫曼树,实现哈夫曼编码,并输出带权路径长度。 #include<iostream>#include<cstring>using namespace std;typedef char**HuffmanCode; typedef struct{ int wei 阅读全文
posted @ 2023-11-30 15:26 涨涨涨张 阅读(27) 评论(0) 推荐(0)
摘要: #include<iostream>using namespace std;//邻接表:顶点表、边表、邻接表#define MVNum 100typedef char OtherInfo;typedef struct ArcNode//边表{ int adjvex;//下标 struct ArcNo 阅读全文
posted @ 2023-11-28 23:28 涨涨涨张 阅读(23) 评论(0) 推荐(0)
摘要: #include<iostream>using namespace std;//邻接矩阵需要顶点表,二维矩阵,还有点数边数#define MVNum 100typedef struct{ char vexs[MVNum]; //顶点表 int arcs[MVNum][MVNum]; //矩阵 int 阅读全文
posted @ 2023-11-28 23:28 涨涨涨张 阅读(30) 评论(0) 推荐(0)
摘要: #include<iostream>#include<cstdio>#include<string>using namespace std;const int N=100010;string split(string s){string ss;for(int i=0;i<s.size();i++){ 阅读全文
posted @ 2023-11-23 15:28 涨涨涨张 阅读(23) 评论(0) 推荐(0)
摘要: #include<stdio.h>#include<malloc.h>#include<string.h> typedef struct BNode{ char data; struct BNode *left; struct BNode *right;}BNode; char str[101]; 阅读全文
posted @ 2023-11-19 23:33 涨涨涨张 阅读(8) 评论(0) 推荐(0)
摘要: 在线性表AB顺序存储合并上出了点问题,主要是不细心导致的c表中数据不是递减以及标点符号导致的编译错误。链表逆置:首先判断链表是否为空或者只有一个结点。三个指针p、t、pp来表示当前结点、下一个结点和前一个结点。初始化时,p指向空,pp指向链表的头节点。循环遍历链表,改变当前结点的指针之前保存下一个结 阅读全文
posted @ 2023-11-18 23:55 涨涨涨张 阅读(15) 评论(0) 推荐(0)
摘要: 已知p指向双向循环链表中的一个结点,其结点结构为data、prior、next三个域,实现交换p所指向的结点和它的前缀结点的顺序。 #include<iostream>#include<cstring>using namespace std;typedef struct f{ int data; f 阅读全文
posted @ 2023-11-17 11:31 涨涨涨张 阅读(17) 评论(0) 推荐(0)
摘要: 7-1 线性表A,B顺序存储合并 有两张非递增有序的线性表A,B,采用顺序存储结构,两张表合并用c表存,要求C为非递减有序的,然后删除C表中值相同的多余元素。元素类型为整型 #include<iostream>#include<cstring>using namespace std;typedef 阅读全文
posted @ 2023-11-17 11:30 涨涨涨张 阅读(35) 评论(0) 推荐(0)
摘要: struct ListNode *reverse(struct ListNode *head){ if(head==NULL||head->next==NULL) { return head; } struct ListNode *p=NULL,*t,*pp=head; while(pp) { t= 阅读全文
posted @ 2023-11-17 11:29 涨涨涨张 阅读(9) 评论(0) 推荐(0)
上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 38 下一页