DMelt:Programming/8 Algorithms
Programming algorithms
DataMelt includes many 3rd party Java libraries that can be used to learn Java, or can be called by Java scripting languages.
For example, it includes java classes from the textbook Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne (http://amzn.to/13VNJi7).
The Javadoc of this library is given here edu.princeton.cs.algs4.package-summary. Here we give a simple example of how to use
this library using Java.
![]() | Use DatMelt search to find an appropriate algorithm for your calculations |
In our next example we will use the edu.princeton.cs.algs4.StdDraw for drawing geometric objects. According to the description, it provides a basic capability for creating drawings with your programs. It uses a simple graphics model that allows you to create drawings consisting of points, lines, squares, circles, and other geometric shapes in a window on your computer and to save the drawings to a file. Standard drawing also includes facilities for text, color, pictures, and animation, along with user interaction via the keyboard and mouse.
Here is Jython code that uses edu.princeton.cs.algs4.StdDraw
This generates an output:
Similarly, one can use Java, BeanShell, Groovy and JRuby.