BOOK:Algorithms, 4th Edition by Robert Sedgewick andKevin Wayne
Algorithms, 4th Edition 配套学习网站:http://algs4.cs.princeton.edu/
setting up asimple Java programming environment
windows: Download algs4.exe
默认安装后需要用到Book里面范例, 用javac-algs4/java-algs4 命令编译运行。
备注:
To make ourtextbook libraries accessible to Java, use the command javac-algs4 instead. Forexample, to compile TestAlgs4.java, which uses ourstandarddrawing library, the autoinstaller issues the the following command:
C:\Users\username\algs4>javac-algs4 TestAlgs4.java |
To make ourtextbook libraries accessible to Java, use the command java-algs4 instead. Forexample, to test standard draw and standard audio type the following twocommands:
C:\Users\username\algs4\hello>java-algs4 edu.princeton.cs.algs4.StdDraw [ displays a graphics window with some geometric shapes and text ]
C:\Users\username\algs4\hello>java-algs4 edu.princeton.cs.algs4.StdAudio [ plays an A major scale ] |
配套书中范例和数据文本:
CODE:http://algs4.cs.princeton.edu/code/
Download: programs as algs4.jar andthe data as algs4-data.zip.
说明:使用书中范例时候,可以使用统配符 import edu.princeton.cs.algs4.*; 替换范例中的 import 行
As of August 17,2015, the "default package" version of algs4.jar has been replacedwith a "named package" version. To access the classes in algs4.jar,you will need to use an import statement like the ones below:
import edu.princeton.cs.algs4.MinPQ; import edu.princeton.cs.algs4.StdIn; |
Note that the I/Olibraries from stdlib.jar are now contained in algs4.jar, so you no longer needstdlib.jar.