- 博客(51)
- 收藏
- 关注
原创 SWUST OJ 641: The Dutch flag problem
【代码】SWUST OJ 641: The Dutch flag problem。
2023-05-20 11:00:55
145
原创 SWUST OJ 425: Polynomial calculate
【代码】SWUST OJ 425: Polynomial calculate。
2023-05-19 23:14:16
55
原创 SWUST OJ 536: The Josephus Problem
【代码】SWUST OJ 536: The Josephus Problem。
2023-05-19 15:41:13
76
原创 SWUST OJ 979: 输出利用先序遍历创建的二叉树的后序遍历序列
#include <stdio.h>#include <stdlib.h>typedef struct TNode{ char data; struct TNode* lchild; struct TNode* rchild;}TNode;TNode* creat(){ char x; TNode* pT; scanf("%c", &x); if (x == '#') pT = NULL; else { pT = (TNode*...
2022-04-24 00:07:40
946
原创 SWUST OJ 978: 输出利用先序遍历创建的二叉树的中序遍历序列
#include <stdio.h>#include <stdlib.h>typedef struct TNode{ char data; struct TNode* lchild; struct TNode* rchild;}TNode;TNode* creat(){ char x; TNode* pT; scanf("%c", &x); if (x == '#') pT = NULL; else { pT = (TNode*...
2022-04-24 00:06:43
972
原创 SWUST OJ 977: 统计利用先序遍历创建的二叉树中的空链域个数
#include <stdio.h>#include <stdlib.h>int n = 0;typedef struct TNode{ char data; struct TNode* lchild; struct TNode* rchild;}TNode;TNode* creat(){ char x; TNode* pT; scanf("%c", &x); if (x == '#') pT = NULL; else { ...
2022-04-24 00:06:04
633
原创 SWUST OJ 976: 统计利用先序遍历创建的二叉树的度为1的结点个数
#include <stdio.h>#include <stdlib.h>int n = 0;typedef struct TNode{ char data; struct TNode* lchild; struct TNode* rchild;}TNode;TNode* creat(){ char x; TNode* pT; scanf("%c", &x); if (x == '#') pT = NULL; else { ...
2022-04-24 00:05:19
477
原创 SWUST OJ 975: 统计利用先序遍历创建的二叉树的度为2的结点个数
#include <stdio.h>#include <stdlib.h>int n = 0;typedef struct TNode{ char data; struct TNode* lchild; struct TNode* rchild;}TNode;TNode* creat(){ char x; TNode* pT; scanf("%c", &x); if (x == '#') pT = NULL; else { ...
2022-04-24 00:04:31
808
原创 SWUST OJ 973: 统计利用先序遍历创建的二叉树叶结点的个数
#include <stdio.h>#include <stdlib.h>int n = 0;typedef struct TNode{ char data; struct TNode* lchild; struct TNode* rchild;}TNode;TNode* creat(){ char x; TNode* pT; scanf("%c", &x); if (x == '#') pT = NULL; else { ...
2022-04-24 00:03:44
310
原创 SWUST OJ 972: 统计利用先序遍历创建的二叉树的宽度
#include <stdio.h>#include <stdlib.h>#define MAXSIZE 100int a[MAXSIZE];typedef struct TNode{ char data; struct TNode* lchild; struct TNode* rchild;}TNode;TNode* creat(){ char x; TNode* pT; scanf("%c", &x); if (x == '#')...
2022-04-24 00:02:59
908
原创 SWUST OJ 971: 统计利用先序遍历创建的二叉树的深度
#include <stdio.h>#include <stdlib.h>typedef struct TNode{ char data; struct TNode* lchild; struct TNode* rchild;}TNode;TNode* creat(){ char x; TNode* pT; scanf("%c", &x); if (x == '#') pT = NULL; else { pT = (TNode*...
2022-04-24 00:02:08
1008
原创 SWUST OJ 963: 小偷的背包
#include <stdio.h>#define MAXSIZE 100int bag(int s, int n, int a[MAXSIZE]){ if (s == 0) return 1; if (s != 0 && n <= 0) return 0; if (bag(s - a[n - 1], n - 1, a) == 1) return 1; bag(s, n - 1, a);}int main(){ int s, n,...
2022-04-23 23:32:00
117
原创 SWUST OJ 1027: 舞伴问题
#include <stdio.h>#include <stdlib.h>typedef struct QNode{ char data; struct QNode* next;}QNode;void enQ(QNode* pQ, int e){ QNode* pR, * pT; pR = pQ; while (pR->next != NULL) pR = pR->next; pT = (QNode*)malloc(sizeof(QN...
2022-04-23 23:31:02
347
原创 SWUST OJ 966: 打印杨辉三角形
#include <stdio.h>#include <stdlib.h>typedef struct QNode{ int data; struct QNode* next;}QNode;void push(QNode* pQ, int x){ QNode* pR, * pS; pR = pQ; while (pR->next != NULL) pR = pR->next; pS = (QNode*)malloc(sizeof...
2022-04-23 23:30:17
175
原创 SWUST OJ 1046: 链栈基本操作的实现
#include <stdio.h>#include <stdlib.h>typedef struct SNode{ int data; struct SNode* next;}SNode;void push(SNode* pS, int num){ SNode* pR; pR = (SNode*)malloc(sizeof(SNode)); pR->data = num; pR->next = pS->next; pS->...
2022-04-23 23:28:09
466
原创 SWUST OJ 1044: 顺序栈基本操作的实现
#include <stdio.h>#include <stdlib.h>#define MAXSIZE 100typedef struct{ int data[MAXSIZE]; int top;}SqStack;void push(SqStack* pS){ int n, x, i = 0; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &x); pS...
2022-04-23 23:27:11
391
原创 SWUST OJ 1043: 利用栈完成后缀表达式的计算
#include <stdio.h>#include <stdlib.h>typedef struct SNode{ int data; struct SNode* next;}SNode;int push(SNode* pS, int x){ SNode* pR; pR = (SNode*)malloc(sizeof(SNode)); pR->data = x; pR->next = pS->next; pS->next = .
2022-04-23 23:26:15
99
原创 SWUST OJ 1042: 中缀表达式转换为后缀表达式
#include <stdio.h>#include <stdlib.h>typedef struct SNode{ char data; struct SNode* next;}SNode;void pushs(SNode* pS, char e){ SNode* pR, *pQ; pQ = pS; while (pQ->next != NULL) pQ = pQ->next; pR = (SNode*)malloc(sizeof(...
2022-04-23 23:24:55
264
原创 SWUST OJ 1028: 特定字符序列的判断
#include <stdio.h>#include <stdlib.h>typedef struct SNode{ char data; struct SNode* next;}SNode;void push(SNode* pS, char x){ SNode* pR; pR = (SNode*)malloc(sizeof(SNode)); pR->data = x; pR->next = pS->next; pS->ne...
2022-04-23 23:23:06
270
原创 SWUST OJ 962: 括号匹配问题
#include <stdio.h>#include <stdlib.h>#include <string.h>#define MAXSIZE 100typedef struct SNode{ char data; struct SNode* next;}SNode;int push(SNode* pS, char a){ SNode* pR; pR = (SNode*)malloc(sizeof(SNode)); pR->dat...
2022-04-23 23:22:01
730
原创 SWUST OJ 961: 进制转换问题
#include <stdio.h>#include <stdlib.h>typedef struct SNode{ int data; struct SNode* next;}SNode;void push(SNode* pS, int t){ SNode* pR; pR = (SNode*)malloc(sizeof(SNode)); pR->data = t; pR->next = pS->next; pS->next...
2022-04-23 23:21:12
351
原创 SWUST OJ 1040 一元多项式加法运算的实现
#include <stdio.h>#include <stdlib.h>typedef struct LNode{ int data; int index; struct LNode* next;}LNode;void initLinkList(LNode* pL){ int m, n; LNode* pR, * pS; pR = pL; while (1) { scanf("%d,%d", &m, &n); if (m...
2022-04-19 17:16:05
311
原创 SWUST OJ 1039 单链表中信息的分类
#include <stdio.h>#include <stdlib.h>#include <string.h>#define MAXSIZE 100 typedef struct LNode{ char data; struct LNode* next;}LNode;void initLinkList(LNode* pL){ int n, i = 0; char a[MAXSIZE]; LNode* pR, * pS; pR = p...
2022-04-19 17:15:24
841
原创 SWUST OJ 960 双向链表的操作问题
#include <stdio.h>#include <stdlib.h>typedef struct LNode{ int data; struct LNode* prior; struct LNode* next;}LNode;void initLinkList(LNode* pL){ int n, i = 0; LNode* pR, * pS; pR = pL; scanf("%d", &n); for (i = 0; i <...
2022-04-19 17:14:41
465
1
原创 SWUST OJ 957 逆置单链表
#include <stdio.h>#include <stdlib.h>int n;typedef struct LNode{ char data; struct LNode* next;}LNode;void initLinkList(LNode* pL){ int i = 0; LNode* pR, * pS; scanf("%d", &n); getchar(); pR = pL; for (i = 0; i < n; ...
2022-04-19 17:14:00
747
1
原创 SWUST OJ 956 约瑟夫问题的实现
#include <stdio.h>#include <stdlib.h>typedef struct LNode{ int data; struct LNode* next;}LNode;void initLinkList(LNode* pL){ int n, i = 2; LNode* pR, * pS; scanf("%d", &n); pL->data = 1; pR = pL; for (i = 2; i <= n;...
2022-04-19 17:12:47
424
原创 SWUST OJ 955 单链表上查找算法的实现
#include <stdio.h>#include <stdlib.h>int n;typedef struct LNode{ int data; struct LNode* next;}LNode;void initLinkList(LNode* pL){ int i = 0; LNode* pR, * pS; scanf("%d", &n); pR = pL; for (i = 0; i < n; i++) { pS ...
2022-04-19 17:11:50
167
原创 SWUST OJ 954 单链表的链接
#include <stdio.h>#include <stdlib.h>typedef struct LNode{ char data; struct LNode* next;}LNode;void initLinkList(LNode* pL){ int n, i = 0; LNode* pR, * pS; scanf("%d", &n); getchar(); pR = pL; for (i = 0; i < n; i++)...
2022-04-19 17:10:41
451
原创 SWUST OJ 953 单链表的删除操作的实现
#include <stdio.h>#include <stdlib.h>int n;typedef struct LNode{ int data; struct LNode* next;}LNode;void initLinkList(LNode* pL){ int i = 0; LNode* pR, * pS; scanf("%d", &n); pR = pL; for (i = 0; i < n; i++) { pS ...
2022-04-19 17:08:28
1327
原创 SWUST OJ 952 单链表的插入操作的实现
#include <stdio.h>#include <stdlib.h>int n;typedef struct LNode{ int data; struct LNode* next;}LNode;void initLinkList(LNode* pL){ int i = 0; LNode* pR, * pS; scanf("%d", &n); pR = pL; for (i = 0; i < n; i++) { pS ...
2022-04-19 17:07:33
1339
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人