Semua buku

Profesional

Aplikasi Tentang Pelatih Masuk Mulai membaca

Computer Science · Glosarium

Apa itu Number of halvings?

Dikenal juga sebagai: number of halvings h(n)

Definition 17.5 High School Computer Science · Bab 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.
Baca dalam konteks →