Another way of explaining log2 8 is: if we kept dividing 8 by 2 until we ended up with 1, how many 2s would we have in our equation? 8 / 2 / 2 / 2 = 1 In other words, how many times do we need to divide 8 by 2 until we end up with 1? In this example, it takes us 3 times. Therefore, log2 8 = 3. Similarly, we could explain log2 64 as: how many times do we need to halve 64 until we end up with 1? 64 / 2 / 2 / 2 / 2 / 2 / 2 = 1 Since there are 6 2s, log2 64 = 6.570 ↱
A Common-Sense Guide to Data Structures and Algorithms
Level Up Your Core Programming Skills
Jay Wengrow