惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

W
WeLiveSecurity
T
Tenable Blog
Project Zero
Project Zero
C
Cybersecurity and Infrastructure Security Agency CISA
T
The Exploit Database - CXSecurity.com
P
Palo Alto Networks Blog
S
Schneier on Security
Scott Helme
Scott Helme
S
Securelist
Know Your Adversary
Know Your Adversary
Vercel News
Vercel News
IT之家
IT之家
V
V2EX
F
Fortinet All Blogs
Simon Willison's Weblog
Simon Willison's Weblog
K
Kaspersky official blog
博客园_首页
T
Tailwind CSS Blog
The GitHub Blog
The GitHub Blog
Spread Privacy
Spread Privacy
Microsoft Security Blog
Microsoft Security Blog
Cisco Talos Blog
Cisco Talos Blog
The Register - Security
The Register - Security
有赞技术团队
有赞技术团队
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Cyberwarzone
Cyberwarzone
Google DeepMind News
Google DeepMind News
The Hacker News
The Hacker News
L
LINUX DO - 热门话题
Hugging Face - Blog
Hugging Face - Blog
博客园 - 三生石上(FineUI控件)
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
CXSECURITY Database RSS Feed - CXSecurity.com
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
Threat Research - Cisco Blogs
P
Proofpoint News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Privacy & Cybersecurity Law Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
CERT Recently Published Vulnerability Notes
S
SegmentFault 最新的问题
AWS News Blog
AWS News Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
罗磊的独立博客
Apple Machine Learning Research
Apple Machine Learning Research
P
Proofpoint News Feed
The Cloudflare Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Vulnerabilities – Threatpost

算法 | 酷 壳 - CoolShell

Leetcode 编程训练 | 酷 壳 - CoolShell 一些有意思的算法代码 | 酷 壳 - CoolShell 可视化的数据结构和算法 | 酷 壳 - CoolShell 一些有意思的文章和资源 | 酷 壳 - CoolShell 可视化的排序过程 | 酷 壳 - CoolShell 计算机编程简史图 | 酷 壳 - CoolShell 一些重要的算法 | 酷 壳 - CoolShell 算法和数据结构词典 | 酷 壳 - CoolShell 一个排序算法比较的网站 | 酷 壳 - CoolShell
一个显示排序过程的Python脚本 | 酷 壳 - CoolShell
陈皓 · 2009-04-15 · via 算法 | 酷 壳 - CoolShell

之前向大家介绍过《一个排序算法比较的网站》,那个网站用动画演示了各种排序算法,并分析了各种排序算法。这里,要向大家推荐一个Python脚本,其可以把排序的过程给显示出来。

下图是“冒泡排序”的一个示例,其中:

  1. 折线表示了各个元素的位置变化。
  2. 折线的深浅表示了元素的大小。越深则越大。

bubble

同样,还有其它一些排序算法的图片:

堆排序(Heap Sort)

heap

选择排序(Selection)

selection

快速排序(Quick)

quick

Shell排序

shell

插入排序(Insertion)

listinsertion

你可以使用如下的Python代码来制作这些图片:(需要 Cairo图片库支持)

Python排序脚本

这个脚本参数如下:

  • -a 表示使用什么样的算法,取值为"quick", "heap", "selection", "insertion", "bubble", "shell"。
  • -n 表示要排序的数据个数。
  • -f 表示输入文件。
  • -p 表示文件前缀。
  • -d 表示输出顺序。
  • -x 图片宽度。
  • -y 图片高度。
  • -l 所有线的宽度。
  • -b 边界宽度。

使用示例如下:

./visualise.py -l 6 -x 700 -y 300 -n 15

文章:来源

Loading...