Custom logarithmic function in C++

When I participated in the Blue Bridge Cup provincial competition this year, I needed a logarithmic function based on the base 2 to solve the problem. That is, which depth and maximum is the balance of a binary tree. I immediately thought of using the log2 function. The subscript of the array belongs to which depth. As a result, in the .chm help file of the blue bridge cup, only the log function of log() and log10() is found, and there is no logarithmic function of the custom bottom. Fortunately, at that time, the wit was used to directly find the result of the second from 1 to n.
Today I have to do a logarithmic function. I want to learn it. I found that C++ does not have a custom logarithmic function.

loga(n)/loga(m) = logm(n)

double res = log(n)/log(m);    //res = logm(n)

Intelligent Recommendation

Logarithmic function image enhancement

Logarithmic function image enhancement In the previous article, the linear enhancement of the image we talked about is a linear enhancement for the case where the overall pixel value of the black and ...

python plot logarithmic function

python plot logarithmic function a>1 Complete code Effect picture a>1 Complete code Effect picture Logarithmic function vs exponential function Complete code Effect picture references In the las...

Polynomial logarithmic function study notes

I have been learning some polynomial boards recently... Pre-skills:Polynomial inversion The problem is for f ( x ) = ln ⁡ g ( x ) f(x)=\ln g(x) f(x)=lng(x),A known g ( x ) g(x) g(x),begging f ( x ) f(...

Multi-class logarithmic function (LN)

Multi-class logarithmic function (LN) A known A ( x ) A(x) A(x)Seeking B ( x ) = ln ⁡ A ( x ) B(x)=\ln A(x) B(x)=lnA(x)of B ( x ) B(x) B(x) Consider seeking first, post points B ′ ( x ) = A &pri...

More Recommendation

c language|various logarithmic operations

Main functions 1. Fill the memory with random numbers up to 100 2. Write N numbers to the file 3. Read the N numbers in the file into memory 4. Sort N numbers 5. Write the sorted N numbers to another ...

How to use the mathematical function library to calculate logarithmic functions such as ln and log in c#

You can use the general calculation function of the logarithmic function: Math.Log(),But there are many mistakes about the use of this function on the Internet. The first parameter is the value you wa...

C/C++ custom function

1, the call function must be outside the int main () 2, the called sub-function does not return a value, use void, otherwise it will report the sub-function does not return a value. 1 has a return val...

Logarithmic loss function and maximum likelihood loss function

1, the maximum likelihood loss function (Likelihood loss) Commonly used in classification problems. Formally, the probability of each predicted value is multiplied to obtain a loss value. For example:...

C language--custom function

[@C language] about custom functions return_type function_name([datetype|arg|],[datetype arg2],[…]) { //Function body } The three elements of the function: function return value function name p...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top