\documentclass[11pt]{article}

\usepackage{amsmath} % Math Symbols
\usepackage{latexsym} % Other Symbols
\usepackage{times,mathptm} % Math Times Font
\usepackage{enumitem} % Enumeration Options
\usepackage{mathpazo} % Math Pazo Font
\usepackage{listings} % Monospaced Code Font

\lstset{basicstyle=\small\ttfamily\bfseries} % Sets Code Font

\textwidth 6.5truein          
\textheight 9.1truein
\oddsidemargin 0.0in
\topmargin -0.9in
\thispagestyle{empty} 

\parindent 0pt          
\parskip 0pt

\begin{document}

\hspace{12cm}
{\bf Name: } % Your name here

\begin{large}
\centerline {\bf Computer Science 303}
\centerline {\bf Algorithms}
\centerline {\bf Summer 2026}
\centerline {\bf Assignment 1}

\vskip .7cm

\bf Due: Tuesday, 6/2/26 11:59 p.m.
\end{large}
\vskip 0.5cm
Answer the following questions and submit typeset solutions by the due date.  As stated in the Honor Code on the syllabus, any outside sources must be listed under the corresponding problem.  Further, your final submission must be completely your own work.
\begin{enumerate}
\item {[6 points]}  Order the following functions in a list so that each function is big-O of the next function in the list (i.e., from slowest growing to fastest growing).\\
\\$f_1(n) = 3n^3+2n$
\\$f_2(n) = 8n$
\\$f_3(n) = n^2+7n$
\\$f_4(n) = 2n^{\frac{1}{2}}$
\\$f_5(n) = n^2(\log n)^3$
\\$f_6(n) = n!$
\\$f_7(n) = 1000$
\\$f_8(n) = 3^n$
\\$f_9(n) = \log(\log n)$
\\$f_{10}(n) = \log n$


\vskip 0.7cm
\item {[16 points]}  An algorithm takes 4ms for input size 128.  How long will it take for input size 1024 if the running time is the following (assume low-order terms are negligible)?
\begin{enumerate}[label=\alph*.]
    \item linear
    \item $O(N \lg N)$
    \item quadratic
    \item cubic
\end{enumerate}


\vskip 0.7cm
\item {[12 points]} An algorithm takes 4ms for input size 128.  How large a problem can be solved in 1 s if the running time is the following (assume low-order terms are negligible)?
\begin{enumerate}[label=\alph*.]
    \item linear
    \item quadratic
    \item cubic
\end{enumerate}

\vskip 0.7cm
\item {[15 points]} Use induction to prove the following for $n \geq 1$.\\
\par
\hspace{3cm} $\displaystyle \sum_{i=0}^{n}(2i-1) = n^2-1$

\vskip 1cm
\item {[15 points]} Use induction to prove that the following equality holds for every positive integer $n$:\\
\par
\hspace{3cm} $\displaystyle \sum_{i=0}^{n}3^i = (3^{n+1}-1)/2$

\vskip 1cm
\item {[16 points]} Let $T_1(N) = O(f(N))$ and $T_2(N) = \Omega(f(N))$, which of the following are guaranteed to always be true?  For those that are always true, provide mathematical reasoning using the definition of asymptotic functions from class, or a graph.  For those that are not always true, provide an example (i.e., functions for $T_1(N)$, $T_2(N)$, and $f(N))$ that make the statement false.  Assume standard definitions, but not necessarily good practice.
\begin{enumerate}[label=\alph*.]
    \item $T_1(N) = O(T_2(N))$
    \item $T_1(N) = \Omega(T_2(N))$
    \item $T_1(N) = \Theta(T_2(N))$
    \item $T_1(N) + T_2(N) = \Omega(f(N))$
\end{enumerate}

\vskip 0.7cm
\item {[20 points]} For each of the following algorithms, calculate:\\
\begin{enumerate}[label=\alph*.]
    \item A run time estimation, $T(n)$, where each aritmetic, comparison, and assignment operation takes 1 unit of time (an increment operation, such as {fontfamily{cmtt}\selectfont i++} also takes 1 unit of time, as in the slides).
    \item A big-O estimate.\\
    \begin{enumerate}
        \item \begin{lstlisting}
    sum = 0;
    for (i = 0; i < n; ++i) {
        sum += 2;
    } \end{lstlisting}

        \item \begin{lstlisting}
    sum = 0;
    for (i = 0; i < n; ++i) {
        for (j = 1; j <= i; ++j) {
            sum += 2;
        }
    } \end{lstlisting}

        \item \begin{lstlisting}
    sum = 0;
    for (i = 0; i <= n; ++i) {
        for (j = 0; j < 8; ++j {
            for (k = 0; k <= n; ++k) {
                sum += k
            }
        }
    }
        \end{lstlisting}
    \end{enumerate}
\end{enumerate}

\end{enumerate}

\end{document}