题目要求:/**
* Return the standard deviation of all the elements in the array
* a = average of the array
* s = sqrt( ((a[0]-a)^2 + (a[1]-a)^2 + . . . + (a[n]-a)^2)/n )
* where b^2 denoted b times b or b squared
*
* Example:
* input: {10.0, 15.0, 10.0, 5.0, 12.0, 9.0, 7.0, 11.0}
* output: 2.85
*/
public static double stddev(double [ ]) {
return 0.0;
}
* Return the standard deviation of all the elements in the array
* a = average of the array
* s = sqrt( ((a[0]-a)^2 + (a[1]-a)^2 + . . . + (a[n]-a)^2)/n )
* where b^2 denoted b times b or b squared
*
* Example:
* input: {10.0, 15.0, 10.0, 5.0, 12.0, 9.0, 7.0, 11.0}
* output: 2.85
*/
public static double stddev(double [ ]) {
return 0.0;
}
解决方案 »
- 纠结了3,4天的一个问题,尝试过很多方法都没解决。求助!急急急!!!
- 把控制台的输入,写入到文件,这样写有什么不对
- 关于java浮点运算的一个怪异现象:0.01+0.09不等于0.1?!
- 堆和栈究竟有什么区别?
- 怎样建一个交流平台????????????急急急急急!!!!!!
- SocketAppender的用法
- 安装了java3d-1_3_1-windows-i586-opengl-sdk.exe 不知道如何配置!
- 关于获得系统时间的问题?希望大家过来看一下
- 有个JLabel比如说大小为(200,100),而又有个字符串,其长度超过200,给如何在JLabel上显示完字符串的内容呢
- C#会让我们这些java程序员下岗吗?
- 为什么a++,不自加1,就几行代码。。。
- 请问一下java编译的问题
(a[0]-a)^2 + (a[1]-a)^2 + . . . + (a[n]-a)^2
=a[0]^2 + a[1]^2 + ... + a[n]^2 - (a[0]+...+a[n])*2*a + n*a*a累加S2=a[0]^2 + a[1]^2 + ... + a[n]^2, S=(a[0]+...+a[n])
a=S/n
然后就可以得到结果,时间O(n)