![]() ![]() |
| |||||||||
| Hotspots: Slides and Code TA Corner Comments? Announcements FAQ Static Webspace | ||||||||||
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| 16 bits gives you a range +/- 64000, not 1024. You need fewer bits to represent 1024. What's log-base-2 of 1024? Or, what's n where 2-to-the-nth power is 1024? Mark Guzdial |
| Assume 1 byte per character. A string can hold a maximum of 1024 characters. How many bits are needed to represent the ACTUAL length of a particular string? The string could have zero or one character in it, or 1024. Mark Guzdial |
| 2 to the fourth isn't 1024. Mark Guzdial |
| As for which lecture: Early on, when I told you that n bits have 2-to-the-nth patterns in them. Mark Guzdial |
| No, for #2 (the Basic line numbers that go from 0 to 65536), the answer is not 40 bits. 2 raised to the 40th power is a VERY large number. Anybody remember the child's song "Inchworm"? "2 and 2 is 4, 4 and 4 is 8, 8 and 8 is 16, and 16 and 16 is 32"? 2 to the 2nd is 4, 2 to the 3rd is 8, 2 to the 4th is 16, 2 to the 5th is 32. When do you hit 1024 (for problem #4)? When do you hit 65536 (for problem #5)? The curve goes up pretty quickly – you don't have to go much farther than the "Inchworm" song. Mark Guzdial |
| Yep. Mark Guzdial |
| See earlier. 4 bytes is not 1024 bits. Mark Guzdial |