Coursera Algorithms Part 1 Hello World 练习答案
Submit a zip file named hello.zip that contains only the three source files HelloWorld.java, HelloGoodbye.java, and RandomWord.java.
Using algs4.jar. Under construction. Write a program RandomWord.java that reads a sequence of words from standard input and prints one of those words uniformly at random. Do not store the words in an array or list. Instead, use Knuth’s method: when reading the ith word, select it with probability 1/i to be the champion, replacing the previous champion. After reading all of the words, print the surviving champion.
100% 满分解答,第三题见RandomWord.java
文件
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。