DEV Community

Cover image for Algorithm Problem 1
Niladri Banerjee
Niladri Banerjee

Posted on

Algorithm Problem 1

Let's document this solving carefully.

Given:
We need to find the smallest integer 𝑛 such that

That is, when the quadratic algorithm becomes faster than the exponential one.

This is the Brute Force solution.

But then I ask to myself is there any other way to solve this issue?

  • Then I found the Lambert W function method.

Before solving this issue I have to work on the basics.

Exponential function:

Then domain of this function is all real numbers (R) and the Range of this equation is Positive Real number.
For all Real numbers of n, the value of this equation is always positive.
Domain: (-∞ , ∞)
Range: (0,∞)

Inverse function:

This is a natural log
ln of zero is -∞ and all negative number is undifined.
Domain: (0,∞)
Range: (-∞ , ∞)

Exponential Lambert function:

Domain: (-1,∞)
Range: [ -e^-1 , ∞)

Inverse of Lambert function:

Domain: [ -e^-1 , ∞)
Range: (-1,∞)

This function is interesting There is a dip then the growth at -1.

Solve :

*1: Prerequisites *

*2: Solving *

*3: Solving *

Solving this problem is easy but when you ask the questions after solving from there the real learning will start. Here we use Lambert equation, Newton Method for approximation. This is the beginning of learning.

Top comments (0)