全部书籍

专业

应用 关于 Coach 登录 开始阅读

书籍暂未推出简体中文版——当前显示英文版。

Computer Science · 术语表

什么是 Number of halvings?

又称: number of halvings h(n)

Definition 17.5 High School Computer Science · 第 17 章 — The Cost of an Algorithm

For a whole number n≥1n \ge 1, the number of halvings h(n)h(n) is the number of times nn can be halved, rounding down, before it reaches 11. It is the whole number hh such that 2h≤n<2h+12^h \le n < 2^{h + 1}.

Halving 1000, rounding down: after 9 halvings only 1 is left, so h(1000) = 9, and indeed 29 = 512 1000 < 1024.
Halving 10001000, rounding down: after 99 halvings only 11 is left, so h(1000)=9h(1000) = 9, and indeed 29=512≤1000<10242^9 = 512 \le 1000 < 1024.
在原文中阅读 →