输入样例:
5
I abc
Q abc
Q ab
I ab
Q ab输出样例:
1
0
1 #include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;const int N 2e410;
int son[N][26],cnt[N],idx;
char str[N];void Insert(char c[])…
2022.1.27 练习 PAT甲 1043 Is It a Binary Search Tree(原题链接)
每次复制一段代码到其他地方,都不记得把该改的都改完了,你不0分谁0分,我对自己呵呵两声。。。。 题解如下:
#include <bits/stdc.…
2022.1.28 练习 PAT甲 1099 Build A Binary Search Tree (原题链接)
题解如下:
#include <bits/stdc.h>
using namespace std;
const int MAX_SIZE110;
int n;
int indexx0;
int num[MAX_SIZE];struct node
{int data;int lchild;int…
2022.1.29 练习 PAT 甲 1066 Root of AVL Tree (原题链接)
建立一颗平衡二叉树(代码参考算法笔记对应内容)
题解如下:
#include <bits/stdc.h>
using namespace std;int n;
int d[22];struct node
{int data;…
题目来源:PAT (Advanced Level) Practice
A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the root that results in a highest tree. Such a root is ca…
哈夫曼树中的查找算法(Select)哈夫曼树的构建(HuffmanTree)哈夫曼编码的构建(HuffmanCoding)打印哈夫曼树表(Print)打印权值及其编码(Inputcode) 什么是哈夫曼树?
当有 n 个结点(都做叶子结点且都有各自的…