An open API service indexing awesome lists of open source software.

https://github.com/tahmidefaz/no-sqrt

Estimates the square root of a number without the sqrt() function
https://github.com/tahmidefaz/no-sqrt

algorithm binary-search python python3 square-root-estimate

Last synced: 9 months ago
JSON representation

Estimates the square root of a number without the sqrt() function

Awesome Lists containing this project

README

          

# no-sqrt
Estimates the square root of a number without the sqrt() function.
Uses binary search algorithm to find the root of a number.

## Explanation
### We know that:

`if sqrt(x) = z, then x = z^2`

So, `if given x`, we need to find a number between 0 and x whose square is equal to x.
To find a z whose square is equal to x, the program uses binary search.

Time complexity: **bigO = O(log n)**