
案例1
常规解决方法:
生成30个随机数,必然有重复的

预计生成统计结果的形式

-
创建初始字典
Paste_Image.png
-
迭代出统计结果字典
Paste_Image.png
推荐的解决方法:


结果与c相同

出现频率最高的3个元素

案例2
统计源文件:linux的编码规范

读入文章到字符串(txt)

非字母为分隔,得到一个大列表

统计频率传给c3变量

显示出现次数最高的10个单词

生成30个随机数,必然有重复的
预计生成统计结果的形式
创建初始字典
迭代出统计结果字典
结果与c相同
出现频率最高的3个元素
统计源文件:linux的编码规范
读入文章到字符串(txt)
非字母为分隔,得到一个大列表
统计频率传给c3变量
显示出现次数最高的10个单词
本文标题:2-3 如何统计序列中元素的出现频度
本文链接:https://www.haomeiwen.com/subject/xtuwuttx.html
网友评论