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

推荐订阅源

T
The Blog of Author Tim Ferriss
S
Securelist
D
Docker
The Register - Security
The Register - Security
GbyAI
GbyAI
Recorded Future
Recorded Future
Engineering at Meta
Engineering at Meta
Stack Overflow Blog
Stack Overflow Blog
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
罗磊的独立博客
博客园 - 【当耐特】
F
Full Disclosure
WordPress大学
WordPress大学
腾讯CDC
小众软件
小众软件
大猫的无限游戏
大猫的无限游戏
D
DataBreaches.Net
SecWiki News
SecWiki News
L
Lohrmann on Cybersecurity
I
InfoQ
MyScale Blog
MyScale Blog
量子位
Cyberwarzone
Cyberwarzone
博客园 - 三生石上(FineUI控件)
The Hacker News
The Hacker News
F
Fortinet All Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Jina AI
Jina AI
博客园_首页
H
Help Net Security
K
Kaspersky official blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Webroot Blog
Webroot Blog
Blog — PlanetScale
Blog — PlanetScale
V
Vulnerabilities – Threatpost
Y
Y Combinator Blog
The Cloudflare Blog
P
Proofpoint News Feed
V
Visual Studio Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tailwind CSS Blog
爱范儿
爱范儿
P
Privacy International News Feed
Security Archives - TechRepublic
Security Archives - TechRepublic
The GitHub Blog
The GitHub Blog
C
Cybersecurity and Infrastructure Security Agency CISA
B
Blog RSS Feed

算法 | 酷 壳 - 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...