COMP 1001 Lecture 7: comp

36 views15 pages

Document Summary

Binary numbers 5 bags with 16, 8, 4, 2, 1, rocks each class 3. Bigger numbers than 31 you can just add more bags of pebbles like 16, 32, 64, etc. Algorithm approach to get the number we want no matter how big it is. While x is not zero: open the largest bad we can, subtract its number of pebbles from x and repeat until you get zero. Binary digits 0 and 1, each column is double its neighbout. Decimal digits between 0 and 9, each colum is 10 times its number. Ada love lace portrait 1st woman to do code. A-f. each column is 16 times its neighbour. 0b=zero b tells phyton that is a binary number. Algorithmic approach x- number we want class 4. While x not equal to zero; choose the largest column we can, and divide x by its value, ignoring fractions. The value in that column is the result.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents