Sie sind auf Seite 1von 3

Michael S.

Walker
September 15, 2018

COMP 2655: Information Structures I


Assignment 1: PART 1

1. Convert each question as specified:


a) 10213 to base10 by summing the expanded notation.

dn ∗ B n + dn−1 ∗ B n−1 + · · · + d2 ∗ B 2 + d1 ∗ B 1 + d0

10213 ⇒ base10
=⇒ 1 ∗ 3 + 0 ∗ 3 + 2 ∗ 31 + 1 ∗ 30
3 2

= 27 + 0 + 6 + 1
= 3410

b) 1101011012 to base10 using Horner’s rule.

((((dn ∗ B + dn−1 ) ∗ B + dn−2 ∗ B + · · · + d2 ) ∗ B + d1 ) ∗ B + d0 )

1101011012 ⇒ base10
=⇒ ((((((((2 ∗ 1 + 1) ∗ 2 + 0) ∗ 2 + 1) ∗ 2 + 0) ∗ 2 + 1) ∗ 2 + 1) ∗ 2 + 0) ∗ 2 + 1)
= 42910

c) 461148 to base16 using the fact that these are related bases.

4611488 ⇒ base16
=⇒ 100 110 001 001 1002
=⇒ 0100 1100 0100 11002
= 4C4C16

d) 335510 to base9 using any method.

335510 ⇒ base9
=⇒  372  41  4  0
9 3355 9 372 9 41 9 4
2700 360 36
655 12 5
630 9
25 3
18
7
= 45379

1
e) 10356 to base7 using any method.

((((dn ∗ B + dn−1 ) ∗ B + dn−2 ∗ B + · · · + d2 ) ∗ B + d1 ) ∗ B + d0 )

10356 ⇒ base10
=⇒ (((6 ∗ 1 + 0) ∗ 6 + 3) ∗ 6 + 5)
= 23910
base10 ⇒ base7
 34  4  0
7 239 7 34 7 4
210 28
29 6
28
1
= 4617

2. Purely in binary, add : 1100 0100 11112 1000 1010 11012

(carry) 1 1 1 1 1

0 0 0 0 1 1 0 0 0 1 0 0 1 1 1 12 Addend
+ 0 0 0 0 1 0 0 0 1 0 1 0 1 1 0 12 Augend
0 0 0 1 0 1 0 0 1 1 1 1 1 1 0 02 Sum

3. Purely in binary, subtract: 1100 0100 11112 - 1000 1010 11012

(carry) 10 1 Z
Z 10 1 10 10

0 1 1
A 0 0 0 A1 0 0 1 1 1 12 Minuend
+ 0 1 0 0 0 1 0 1 0 1 1 0 12 Subtrahend
0 0 0 1 1 1 0 1 0 0 0 1 02 Difference

2
4. Purely in hex, add: 4 A 0 C 8 716 + 3 0 F D 2 216

(carry) 1 1

4 A 0 C 8 716 Addend
+ 3 0 F D 2 216 Augend
7 B 0 9 A 916 Sum

temp = Addend-digit(n) + Augend-digit(n),


where (n) is the digit position and the addition is in base_10
sum = temp mod base
carry = temp div base
Base_10 Sum, and Carry Results:
-------------------------------
digit(0): sum = 09 mod 16 = 09
carry = 09 div 16 = 00

digit(1): sum = 10 mod 16 = 10 (A)_16


carry = 10 div 16 = 00

digit(2): sum = 25 mod 16 = 09


carry = 25 div 16 = 01

digit(3): sum = 16 mod 16 = 00


carry = 16 div 16 = 01

digit(4): sum = 11 mod 16 = 11 (B)_16


carry = 11 div 16 = 00

digit(5): sum = 07 mod 16 = 07


carry = 07 mod 16 = 00
-------------------------------

5. Purely in hex, subtract: 4 A 0 C 8 716 - 3 0 F D 2 216

(carry) 9 10F
Z 10

A 0
4 @ C 8 716 Minuend
− 3 0 F D 2 216 Subtrahend
1 9 0 F 6 516 Difference

Das könnte Ihnen auch gefallen