Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Does anyone have a library to animate sort algorithms? Is there a bar graph library I can implement?
Posted
Comments
Sergey Alexandrovich Kryukov 4-Feb-12 21:59pm    
I would note that the target for your search is wrong. You should look just for a bar graph (or any graph library) and for sorting algorithm, separately, and put them together.
--SA

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.
 
Share this answer
 
v2
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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900