mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-06 10:31:29 +08:00
Optimized recursive_bubble_sort (#2410)
* optimized recursive_bubble_sort * Fixed doctest error due whitespace * reduce loop times for optimization * fixup! Format Python code with psf/black push Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@ -7,7 +7,11 @@ RealFunc = Callable[[float], float] # type alias for a real -> real function
|
||||
|
||||
|
||||
# function is the f(x) and derivative is the f'(x)
|
||||
def newton(function: RealFunc, derivative: RealFunc, starting_int: int,) -> float:
|
||||
def newton(
|
||||
function: RealFunc,
|
||||
derivative: RealFunc,
|
||||
starting_int: int,
|
||||
) -> float:
|
||||
"""
|
||||
>>> newton(lambda x: x ** 3 - 2 * x - 5, lambda x: 3 * x ** 2 - 2, 3)
|
||||
2.0945514815423474
|
||||
|
Reference in New Issue
Block a user