浙大数据结构PTA
浙大数据结构PTA
头发存活率
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
1005 Spell It Right
#include<iostream>#include<math.h>using namespace std;void digitoutput(int n) { switch (n) { case 0: cout << "zero"; break; case 1: cout << "one"; break; case 2: cout << "two"; break; case 3: cout << "three"; br原创 2022-02-09 23:16:42 · 390 阅读 · 0 评论 -
1006 Sign In and Sign Out
#include<iostream>using namespace std;typedef struct TimeType { int hh; int mm; int ss;} Time;struct ID_group { char s[16]; Time inTime; Time outTime;} Person[100];int main() { int n, j = 0, count = 1, i; cin >> n; for (i = 0;原创 2022-02-08 23:03:17 · 199 阅读 · 0 评论 -
Have Fun with Numbers
#include<iostream>#include<algorithm>#include<math.h>using namespace std;struct Digits { char charnum; int realnum; int flag = -1;}a[21];int main() { int i, count; char p; for (i = 0;; i++) { p = getchar(); a[i].charnum原创 2022-01-29 19:26:29 · 507 阅读 · 0 评论 -
树的一些操作
#include<iostream>using namespace std;typedef int ElementType;typedef struct TNode* Position;typedef Position BinTree;struct TNode { ElementType Data; BinTree Left; BinTree Right;};void InorderTraversal(BinTree BT) { if (BT) { InorderT原创 2021-08-28 09:48:14 · 131 阅读 · 0 评论 -
编程题07 List Leaves
#include<iostream>#include<queue>using namespace std;#define MaxTree 10#define Null -1typedef int ElementType;typedef int Tree;struct TNode { ElementType Data; Tree Left; Tree Right;}T[MaxTree];int sum = 0;Tree BuildTree(struct T原创 2021-08-28 00:59:10 · 156 阅读 · 1 评论 -
编程题06 树的同构
#include<iostream>using namespace std;#define MaxTree 10#define Null -1typedef char ElementType;typedef int Tree;struct TreeNode { ElementType Element; Tree Left; Tree Right;}T1[MaxTree], T2[MaxTree];//全局变量T1 T2Tree BuildTree(struct Tree原创 2021-08-25 00:26:43 · 121 阅读 · 0 评论 -
编程题05 Pop Sequence
#include<iostream>#include<stack>using namespace std;int main() { int capacity, num, cnt; cin >> capacity >> num >> cnt;//capacity堆栈容量 num待检查的元素的个数 cnt组数 while (cnt--) {//循环cnt次 int* a = new int[num + 1];//创建数组存放待检查元素原创 2021-08-24 18:30:25 · 144 阅读 · 0 评论 -
编程题04 Reversing Linked List
在这里插入代码片原创 2021-08-15 23:28:25 · 156 阅读 · 1 评论 -
编程题03 一元多项式的乘法与加法运算
#include<iostream>using namespace std;typedef int ElementType;typedef struct Node* ptrNode;typedef ptrNode LinkList;typedef ptrNode Position;struct Node { ElementType Coefficient; ElementType Exponent; Position Next;};LinkList CreatList(原创 2021-02-16 13:33:35 · 130 阅读 · 0 评论 -
编程题02 Maximum Subsequence Sum
#include<iostream>using namespace std;int main() { int a[100000], i, j, flag = 0, n; int ThisSum, MaxSum = -2147483648; int Maxi, Maxj; cin >> n; for (i = 0; i < n; i++) { cin >> a[i]; if (a[i] >= 0) flag = 1; } if (fl原创 2021-02-15 15:05:32 · 129 阅读 · 0 评论 -
编程题01 最大子列和问题
#include<iostream>using namespace std;constexpr auto MAXSIZE = 10;constexpr auto NotFound = 0;typedef int ElementType;typedef int Position;//Position代表将要用二分查找寻找的数字的位置typedef struct LNode* List;//List是指向结构体的指针struct LNode {//List结构体 ElementT原创 2021-01-27 18:20:41 · 129 阅读 · 0 评论 -
函数题03 二叉搜索树的操作集
#include<iostream>using namespace std;typedef int ElementType;typedef struct TNode* Position;typedef Position BinTree;struct TNode { ElementType Data; BinTree Left; BinTree Right;};void PreorderTraversal(BinTree BT);void InorderTraversal原创 2021-08-29 23:37:28 · 128 阅读 · 0 评论 -
函数题02 两个有序链表序列的合并
#include<iostream>using namespace std;typedef int ElementType;typedef struct Node* PtrToNode;typedef PtrToNode List;struct Node { ElementType Data; PtrToNode Next;};void Print(List L);List Read();List Merge(List L1, List L2);int main()原创 2021-02-13 14:18:48 · 181 阅读 · 0 评论 -
函数题01 二分查找
#include<iostream>using namespace std;#define MAXSIZE 10#define NotFound 0typedef int ElementType;typedef int Position;typedef struct LNode* List;struct LNode { ElementType Data[MAXSIZE]; Position Last;};List ReadInput();Position Binary原创 2021-02-13 14:44:11 · 170 阅读 · 0 评论
分享