\documentclass[11pt]{article}

\usepackage{fullpage}
\usepackage{graphicx}
\usepackage{clrscode3e}




\begin{document}

\title{Algorithms Lab 3}

\date{}
\maketitle



The in-lab problems are to be solved during the lab time.  Work with
your team, but write your solutions individually. You do not need to
turn in your answers, only discuss them with me. Ask me for feedback
on how you write your answers.

The homework problem set is due in one week. Work with your team, but write
your solutions individually. List the people with whom you discussed the
problems.


\vspace{1cm}
\section{ In lab exercises}


Finish the in-class exercises on heaps.


\vspace{1cm}
\section{Homework problems}



\begin{enumerate} 

\item {(GT C-2.31)} Develop an algorithm that computes the $k$th smallest
  element in a set of $n$ distinct integers in $O(n + k \lg n)$
  time.


\item (CLRS 6.5-9) Give an $O(n \lg k)$-time algorithm to merge $k$ sorted
  lists into one sorted list, where $n$ is the total number of elements in
  all the input lists.  (\emph{Hint: use a min-heap for $k$-way merging}.)


\item (CLRS 9-1) Given a set of $n$ numbers, we wish to find the $i$
  largest in sorted order using a comparison-based algorithm. Find the
  algorithm that implements each of the following methods with the
  best asymptotic worst-case running time, and analyze the running
  times of the algorithms on terms of $n$ and $i$.

  \begin{enumerate}
  \item Sort the numbers, and list the $i$ largest.
  \item Build a max-priority queue from the numbers, and call
  EXTRACT-MAX $i$ times.
%   \item Use a SELECT algorithm to find the $i$th largest number,
%   partition around that number, and sort the $i$ largest numbers.
  \end{enumerate}


% \item (C-4.22) Let $A$ and $B$ be two sequences of $n$ integers each.
%   Given an integer $x$, describe an $O(n \lg n)$ algorithm for
%   determining if there is an integer $a$ in $A$ and an integer $b$ in
%   $B$ such that $x = a+b$.

\end{enumerate}


\end{document}
%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 
