首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
wjw
2022年7月8日 21:54
哈夫曼编码应用
P1562
回复 0
|
赞 2
|
浏览 5.7k
此题本质就是将各个字母出现次数作为叶节点权值,然后求带权路径长度,最后还是通过创建小根堆计算非叶节点大小z
Dear_Mr_He
2022年2月5日 00:47
P1562 哈夫曼编码
P1562
回复 1
|
赞 2
|
浏览 6.1k
#include<iostream> #include<cstring> #include<queue> #include<map> using namespace std; struct node { int x; // 定义优先队列的比较关系,这里我们定义的是小根堆 bool operator < (const node& a) const { return x > a.x; } }; int main() { char text[100]; ...
LVBU123
2021年3月23日 15:38
优先队列c++
P1562
回复 0
|
赞 5
|
浏览 9.0k
#include<bits/stdc++.h> using namespace std; int main(){ string s; while(cin>>s){ if(s=="END") break; priority_queue<int,vector<int>,greater<int>> q; int a[128] = {0}; int sum = 0; int weishu = 8*s.size(); double ratio; for(int i=0;i<s...
James
2021年1月31日 20:32
WPL结论
P1562
回复 0
|
赞 3
|
浏览 9.5k
#include <iostream> #include <stdio.h> #include <string> #include <queue> #include <map> #include <iterator> using namespace std; // 利用结论 非叶子节点结点值的和等于WPL 不用一个个计算 int main() { string s; while(cin>&g...
1
2
题目
哈夫曼编码
题解数量
14
发布题解
在线答疑
热门题解
1
哈夫曼编码 题解:c++优先队列实现,注意全为同一字符的特殊情况,例如:BBBBBBBBBB
2
哈夫曼编码的坑
3
题解:哈弗曼编码
4
哈夫曼编码 题解:非叶节点累加和 = WPL
5
哈夫曼编码 题解:
6
哈夫曼编码 题解:通过率50%,哪种情况没考虑到呢?
7
哈夫曼编码 题解:still priority_queue->minHeap but mind the trap!!
8
哈夫曼编码 题解:
9
优先队列c++
10
WPL结论