由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 请教怎么实现sqrt?
相关主题
脸书电话面试第一轮代码题面筋如何计算sqrt
square root的算法F一题:double sqrt如何优化
请问给一个整数,如何返回他的平方根?Fibonacci number interview questions?
几个面试的数学题Google 面试
大牛看看为撒这个sqrt binary search过不了OJ问道题
问一道最简单的题 把一个数拆成任意个平方和的最小拆法有没有把递归转为非递归的比较通俗易懂的解释。
fb二面杯具lc的题目质量越来越差了吧
Sqrt牛顿法一问Offer from Bloomberg
相关话题的讨论汇总
话题: sqrt话题: search话题: 收敛话题: 切法话题: 牛顿
进入JobHunting版参与讨论
1 (共1页)
g********l
发帖数: 68
1
thanks
f*******e
发帖数: 1161
2
拉格朗日变换?

【在 g********l 的大作中提到】
: thanks
g********l
发帖数: 68
3
现场能写出code来?

【在 f*******e 的大作中提到】
: 拉格朗日变换?
f*******e
发帖数: 1161
4
没这么变态吧?

【在 g********l 的大作中提到】
: 现场能写出code来?
C*Y
发帖数: 736
5
对。就是泰勒级数。这是考数学不是考编程
K******g
发帖数: 1870
6
不是用binary search吗?

【在 C*Y 的大作中提到】
: 对。就是泰勒级数。这是考数学不是考编程
g********l
发帖数: 68
7
解释一下?

【在 K******g 的大作中提到】
: 不是用binary search吗?
K******g
发帖数: 1870
8
比如说sqrt(8)
4^2 > 8
2^2 <8
3^2 >8
2.5^2 < 8
2.75^2 < 8
2.875^2 >8
2.8125^2 < 8
...
util error < a certain value

【在 g********l 的大作中提到】
: 解释一下?
h**6
发帖数: 4160
9
设f(x) = x^2 - c,找到f(x) = 0的点就可以了。
牛顿弦切法,比二分查找收敛快。
x[n+1] = x[n] - f(x[n])/f'(x[n]) = x[n] - (x[n]^2-c)/(2*x[n])
f*******e
发帖数: 1161
10
这个好,像是一个编程题了

【在 K******g 的大作中提到】
: 比如说sqrt(8)
: 4^2 > 8
: 2^2 <8
: 3^2 >8
: 2.5^2 < 8
: 2.75^2 < 8
: 2.875^2 >8
: 2.8125^2 < 8
: ...
: util error < a certain value

相关主题
问一道最简单的题 把一个数拆成任意个平方和的最小拆法如何计算sqrt
fb二面杯具F一题:double sqrt如何优化
Sqrt牛顿法一问Fibonacci number interview questions?
进入JobHunting版参与讨论
v******s
发帖数: 144
11
应该是用newton递归, 平方根的Taylor级数收敛很慢。 Newton递归就是延导数的方向
搜索,收敛很快
s*****r
发帖数: 773
12
这个题目我被问了两次, binary search

【在 g********l 的大作中提到】
: thanks
g********2
发帖数: 182
13
i guess this is wrong. This method is used to find extreme points of f(x),
not the roots for f(x) = 0. By the way, i think f(x) = x^3 + 3*c*x might
work.

【在 h**6 的大作中提到】
: 设f(x) = x^2 - c,找到f(x) = 0的点就可以了。
: 牛顿弦切法,比二分查找收敛快。
: x[n+1] = x[n] - f(x[n])/f'(x[n]) = x[n] - (x[n]^2-c)/(2*x[n])

f****4
发帖数: 1359
14
牛顿弦切法应该是正解
但我不清初的是,第一个x0怎么取,速度能快
l***i
发帖数: 1309
15
Search between [x,n/x] if you are to compute sqrt(n)
g********l
发帖数: 68
16
what is x?

【在 l***i 的大作中提到】
: Search between [x,n/x] if you are to compute sqrt(n)
1 (共1页)
进入JobHunting版参与讨论
相关主题
Offer from Bloomberg大牛看看为撒这个sqrt binary search过不了OJ
Computation Science and Engineering问一道最简单的题 把一个数拆成任意个平方和的最小拆法
面经-flextrade, hulu, bloomberg, mircrostrategyfb二面杯具
Bloomberg面经Sqrt牛顿法一问
脸书电话面试第一轮代码题面筋如何计算sqrt
square root的算法F一题:double sqrt如何优化
请问给一个整数,如何返回他的平方根?Fibonacci number interview questions?
几个面试的数学题Google 面试
相关话题的讨论汇总
话题: sqrt话题: search话题: 收敛话题: 切法话题: 牛顿