Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

algorithm complexity - what double star means

Does anybody know what means doubled-star in complexity algorithm like this O(N**3)? I found that one in PHP's similar_text() function and do not understand it.

thx

like image 652
hejdav Avatar asked Dec 06 '22 23:12

hejdav


2 Answers

** means power. Hence, n**3 means n^3. Complexity is of the order n^3 or O(n^3)

like image 56
akshaynagpal Avatar answered Dec 19 '22 02:12

akshaynagpal


This double star is the exponentiation operator in PHP(^ operator in general for exponentiation).

As per PHP manual,

$a ** $b ---- Exponentiation Operator   
Result of raising $a to the $b'th power. Introduced in PHP 5.6.

hence, here the complexity is O(n^3),i.e., O of (n raised to power 3) OR cubic complexity.

like image 44
Am_I_Helpful Avatar answered Dec 19 '22 01:12

Am_I_Helpful