Why are logarithms in computer science considered logarithms of base-2?

In a computer science textbook, I saw the following:

enter image description here

... so I was wondering if anyone could explain to me why.

+4
source share
1 answer

One of the most common methods by which logarithms arise in computer science is to repeatedly divide an array in half, which is often found with separation and rest algorithms, such as binary search, merging, etc. In these cases, the number of times you can split an array of length n twice, before moving on to singleton arrays, this is log 2 n.

- . , log 2 n n. , radix, , . , GCD, , , -, .

, - , , . , "" x ( "" ). , , . , log 2 n , .

, base-two CS. , AVL- , & phi; - . - e, quicksort, , , . , - - - . , , .

, . , ( ), - O (n log n) O (log n).

+13

Source: https://habr.com/ru/post/1671315/


All Articles