动画排序算法 [英] animating a sort algorithm
本文介绍了动画排序算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人有一个动画库来排序算法吗?
Does anyone have a library to animate sort algorithms? Is there a bar graph library I can implement?
推荐答案
您是什么意思?您要观看正在排序的项目吗?我怀疑那里有图书馆,你为什么要那个?条形图将如何显示您被隐含的排序算法,或者这是一个不同的问题?
我删除了您回复自己的地方以及您再次询问的地方.再次,不,我怀疑排序算法的动画效果是人们创建图书馆所需的足够的东西.这是家庭作业吗?我不认为这可能是现实世界中的要求.我认为关键是您自己编写.
What do you mean ? You want to watch items being sorted ? I doubt there''s a library for that, why would you want that ? How would a bar graph show you a sort algorithm being implimented, or is that a different question ?
I deleted where you replied to yourself, and where you asked this again. Again, no, I doubt that an animation of a sort algorithm working is the sort of thing people would need sufficiently to create a library. Is this homework ? I don''t see how it could be a real world requirement. I think the point is that you write it yourself.
这不是一个非常复杂的问题:
1-随机化数组
2-为每个数组元素绘制一条具有其值高度的线.
3-确定在排序算法元素的哪一点被替换,然后在那一点上更新图形.
4-调用排序方法
拥有可运行的应用程序后,您可以增强其图形表示.
要查看一些带有Java applet的示例:
http://maven.smith.edu/~thiebaut/java/sort/ [ ^ ]
http://www.cs.oswego.edu/~mohammad/classes/csc241/samples/sort/Sort2-E.html [ http://www.cs.ubc.ca/~harrison/Java/sorting-demo. html [^ ]
希望对您有所帮助.
It is not a very complicated problem:
1- randomize an array
2- draw a line for each array element with the height of its value.
3- determine in which point of the sort algorithm elements are substituted then update graphics in that point.
4- call the sort method
After having a working application you can enhance its graphical representation.
To see some samples with java applets :
http://maven.smith.edu/~thiebaut/java/sort/[^]
http://www.cs.oswego.edu/~mohammad/classes/csc241/samples/sort/Sort2-E.html[^]
http://www.cs.ubc.ca/~harrison/Java/sorting-demo.html[^]
Hope it helps.
这篇关于动画排序算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文