StdRandom, StdOut, Insertion 无法解析 [英] StdRandom, StdOut, Insertion cannot be resolved

查看:16
本文介绍了StdRandom, StdOut, Insertion 无法解析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这段代码应该实现排序.
我有 3 个错误:
StdRandom 无法解析",
无法解析标准输出",
无法解决插入问题".
可能有一些库要导入?

This code should implement sorting.
I have 3 errors:
"StdRandom cannot be resolved",
"StdOut cannot be resolved",
"Insertion cannot be resolved".
May be there are some libraries to import?

public class randomDoubles 
{
public static void main(String[] args)
{

    int N = Integer.parseInt(args[0]);
    Double[] a = new Double[N];
    for(int i = 0; i < N; i++)
        a[i] = StdRandom.uniform(); // error: StdRandom cannot be resolved
    Insertion.sort(a);                  // error: Insertion cannot be resolved
    for (int i = 0; i < N; i++)
        StdOut.println(a[i]);       // error: StdOut cannot be resolved
}
}

推荐答案

需要用到以下文件

http://introcs.cs.princeton.edu/java/stdlib/StdRandom.java.html

http://algs4.cs.princeton.edu/11model/StdOut.java.html

这篇关于StdRandom, StdOut, Insertion 无法解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆