% Author Info
\def\thetitle{HW2 Data Representation}
\def\theclass{CS105}
\def\university{University of Massachusetts Boston}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% You can ignore all this stuff for now
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass[12pt,letterpaper]{article}

\usepackage{amsmath,amsfonts,amsthm,amssymb}
\usepackage{setspace}
\usepackage{Tabbing}
\usepackage{lastpage}
\usepackage{extramarks}
\usepackage{chngpage}
\usepackage{soul,color}
\usepackage{graphicx,float,wrapfig}
\usepackage[ruled,vlined,linesnumbered]{algorithm2e}
\usepackage{url}
\usepackage{scalefnt}
%Tikz
\usepackage{tikz}
\usetikzlibrary{trees,snakes}
\usetikzlibrary{arrows,automata}
\usetikzlibrary{matrix}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}
\usetikzlibrary{chains,positioning,scopes}



\setlength{\parskip}{0pt} % 1ex plus 0.5ex minus 0.2ex}
\setlength{\parindent}{0pt}

% Increase to 2.0 for double spacing.
\linespread{1}

% Header & Footers
% LaTeX has very generous margins, by default.
% I've shrunk the margins, considerably.
\usepackage[hmargin=2cm,vmargin=3.5cm]{geometry}
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{\thetitle}
\chead{}
\rhead{\theclass}
\lfoot{}
\cfoot{}
\rfoot{\thepage}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0.5pt}

\begin{document}




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% You work below this part
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% $\lnot \Box$
% 
% $\diamondsuit$
% 
% $\bigcirc$


Name:

UMS ID:

Note: You must turn in a hardcopy at the beginning of class. Please show all the steps for your work to get maximum points.
\vspace{10pt}

1. Convert the decimal number $705$ to binary.
\vspace{80pt}


2. Convert the binary number $101101$ to decimal.
\vspace{80pt}


3.  What is the binary string for the color with RGB value [146, 81, 0] given
that 8 bits are used to represent each color? (Hint: The binary string should be
24 bits long).
\vspace{80pt}


4. Compute the following binary multiplication: $1111 \cdot 1111$. The answer should
be in binary form.
\vspace{80pt}


\newpage

5. The following graphs shows a wave, please use (a) 2 bits  (b) 3 bits in each
time interval to convert this wave to a digital signal. It is up to you to
decide what could be the best way to quantize or select levels to digitize the
graph and capture maximum information. Draw the two digital signals in the
graphs below with labels. Please label levels and sampling intervals.


(a)
\begin{center}
  \includegraphics[width=0.9\textwidth]{wave.png}
\end{center}

(b)
\begin{center}
  \includegraphics[width=0.9\textwidth]{wave.png}
\end{center}

\newpage 6.  The following is an 8x6  image and each pixel is made up of 1 bit
(either black or white).

\begin{center}
  \includegraphics[width=0.5\textwidth]{picture.png}
\end{center}

(a) Calculate the total number of bits used to represent this image:
\vspace{60pt}

(b) The number of bytes used to represent this image:
\vspace{60pt}

(c) The number of kilobytes used to represent this image:
\vspace{60pt}

(d) You have decided to store this image in your hard drive and the image needs
to be compressed. The method you choose to use must be lossless. What kind of
compression technique would you use?  Please explain your choice. (Hint: Since
this is a simple black and white image, think about the text compression
methods).







\end{document}