john
john

Reputation: 45

Running time of binary search

Assume I have regular binary search, but I change the mid to 2/3*(min+max).
Will the running time change, or remain (log(n))?

I got c1+c2*log(n)/log(3/2).

Upvotes: 1

Views: 70

Answers (1)

Zim-Zam O'Pootertoot
Zim-Zam O'Pootertoot

Reputation: 18148

It'll still be log(n). You'll have a different log base (3/2 instead of 2), but changing a log base is the same as multiplying by a constant.

Upvotes: 3

Related Questions