chapter 3 data representation Flashcards
what is fixed size numbers
Fixed Size Numbers
Half the natural numbers will represent themselves
The other half will represent negative integers
100= -50 to 49
we count zero
what is ten’s complement? and what is the formula?
Ten’s complement: Using two decimal digits, represent 100 numbers
*If unsigned, the range would be …
– let 1 through 49 represent 1 … 49
– let 50 through 99 represent -50 … -1
formula:
Negative(i) =10^k -i
k is the number of digits and i is the number you what to change
For example, -3 is Negative(3), so using two digits, its
representation is
Negative(3) = 100 – 3 = 97
What about three-digit representation?
Negative(3) = 1000 – 3 = 997
what is two complement?
positive and negative numbers in a binary number representation.
what are real numbers?
its the numbers that come after the decimal point
what is floating point? mantissa? and exponent?
and how do they work together?
floating point: is a way to represent real numbers, including fractions and really big or small values, in a computer.
mantissa = the whole number
exponent = tells us where to move the decimal
sign * mantissa * 10^exponent
example
12001.00 = 12001*10^0
how do you convert fraction to binary?
how do you convert .75 to binary
- Write Down the Fraction: Start with your fraction, like 0.75.
- Multiply by 2: Take your fraction and multiply it by 2. For 0.75, that gives you 1.5.
- Note the Whole Part: Write down the whole part of the result on the left side. In this case, it’s 1.
- Keep the Fraction Part: Take the fractional part of the result (the part after the decimal point), which is 0.5 in this case.
- Repeat Steps 2-4: Now, repeat these steps with the fractional part. Multiply it by 2 again. For 0.5, you get 1.0.
6.Note the Whole Part: Write down the whole part of this new result, which is 1.
7.Repeat Again: Keep repeating these steps, multiplying by 2 and writing down the whole part until the fractional part becomes 0 or until you’ve gotten the number of binary digits you want.
EXAMPLE
Here’s how it looks with 0.75:
0.75 x 2 = 1.5, so you write down 1.
The fractional part becomes 0.5.
0.5 x 2 = 1.0, so you write down 1.
The fractional part becomes 0 (no remainder).
So, in binary, 0.75 is written as 0.11.
what is scientific notation
A form of floating-point representation in which the decimal
point is kept to the right of the leftmost digit
12001.32708
is 1.200132708E+4 in scientific notation (E+4 is how computers
display x104
)
what is keyword encoding?
Replace frequently used patterns of text with a single special
character. the goal is make the data smaller to save room and encode it
what is run-length encoding?
single value may be repeated over and over again in a long sequence
Replace a repeated sequence with
* a flag
* the repeated value
* the number of repetitions
EXAMPLE
* *n8
* * is the flag
* n is the repeated value
* 8 is the number of times n is repeated
remember *n3 is still 3 values
what is huffman encoding
Huffman encoding makes common things shorter in data, like using shortcuts to save space in a message.
huffman encoding is an example of prefix coding
example
1011111001010 = DRAB
what are names for these
BMP?
GIF?
PNG?
JPEG?
vector graphic ?
what are the difference between them?
BMP = bitmap =TrueColor color depth, or less to reduce file size
* Well suited for compression by run-length encoding
gif= indexed color=File explicitly includes palette of 256 or fewer colors
* Each pixel thus requires only 8 or fewer bits
* Animated GIFs are short sequences of images
png = portable network graphics =Intended to replace GIFs
* Greater compression with wider range of color depths
* No animation
jpeg =joint photographic =Suitable for photographs and complex images with millions of colors (24-bit).
=Commonly used for web images, digital photography, and anywhere a good balance between quality and file size is needed.
vector graphics = a format that describes an image in terms of lines and geometric shapes
what is temporal compression
A technique based on differences between consecutive frames:
If most of an image in two frames has not changed, why should
we waste space duplicating information?
what is spatial compression
A technique based on removing repetitive information within a
frame: This problem is essentially the same as that faced when
compressing still images