|
| 1 | +\section{Introduction} |
| 2 | +\subsection{Outline} |
| 3 | + |
| 4 | +\begin{frame} |
| 5 | + \begin{center} |
| 6 | + {\large |
| 7 | + Introduction\bigskip |
| 8 | + |
| 9 | + CP4 -- Chapter 2.1} |
| 10 | + \end{center} |
| 11 | +\end{frame} |
| 12 | + |
| 13 | +\begin{frame}{Motivation} |
| 14 | + |
| 15 | + Choosing the right data structure is very important when writing a program:\medskip |
| 16 | + |
| 17 | + \begin{itemize} |
| 18 | + \item How easy is it to program? |
| 19 | + \item How fast are the operations? |
| 20 | + \item Does it have all the abilities necessary for my algorithm? |
| 21 | + \end{itemize}\bigskip |
| 22 | + |
| 23 | + In this lecture, we review some data structures that are useful for programming challenges.\medskip |
| 24 | + |
| 25 | + Most of these data structures are available in the standard library. A few you have to |
| 26 | + program by hand. |
| 27 | +\end{frame} |
| 28 | + |
| 29 | +\begin{frame}{How to choose a data structure?} |
| 30 | + {Main Operations of a Data Structure} |
| 31 | + Think about which operations you need for your program:\medskip |
| 32 | + |
| 33 | + \begin{columns} |
| 34 | + \column{0.5\textwidth} |
| 35 | + \begin{itemize} |
| 36 | + \item Inserting new data once; |
| 37 | + \item Inserting new data after acessing; |
| 38 | + \item Accessing data in order; |
| 39 | + \item Accessing data out of order; |
| 40 | + \item Re-ordering data; |
| 41 | + \end{itemize} |
| 42 | + \column{0.5\textwidth} |
| 43 | + \begin{itemize} |
| 44 | + \item Updating data; |
| 45 | + \item Deleting data; |
| 46 | + \item Finding data by position; |
| 47 | + \item Finding data by content; |
| 48 | + \item Summarizing data; |
| 49 | + \end{itemize} |
| 50 | +\end{columns}\bigskip |
| 51 | + |
| 52 | +Different data structures will be better or |
| 53 | +worse at these operations.\medskip |
| 54 | + |
| 55 | +You want to use {\bf the simplest} data structure that can do what you need. |
| 56 | +\end{frame} |
| 57 | + |
| 58 | +\begin{frame}{Data Structures and Standard Libraries} |
| 59 | + Most data structures that we use on programming contests are available in the {\bf Standard Libraries}. It is important to know how to use the standard library of your language.\bigskip |
| 60 | + |
| 61 | + However, some specialist data structures are not available, so we have to code them by hand. Sometimes, we also have a modified version of a standard DS.\bigskip |
| 62 | + |
| 63 | + \begin{block}{Personal Code Library} |
| 64 | + When you write many programs, you will discover that you write similar code many times. It is useful to store this code in a "Personal Library" file. |
| 65 | + \end{block} |
| 66 | +\end{frame} |
| 67 | + |
| 68 | +\begin{frame}{Topics we are studying today} |
| 69 | +\begin{block}{Linear Data Structures} |
| 70 | + The STL array, sorting on arrays, |
| 71 | + searching, Deques and stacks |
| 72 | +\end{block} |
| 73 | + |
| 74 | +\begin{block}{Non-Linear Data Structures} |
| 75 | + Priority Queues and Sets/Hashes |
| 76 | +\end{block} |
| 77 | +\begin{block}{Hand Crafted Data Structures} |
| 78 | + Union-Find Disjoint Set |
| 79 | + % (TODO) DSes for Dynamic Range Query\\ |
| 80 | + % (TODO) Bitmask Indexes\\ |
| 81 | +\end{block} |
| 82 | +\end{frame} |
| 83 | + |
| 84 | +\begin{frame}{Topics we are NOT studying today} |
| 85 | + \begin{alertblock}{Data Structure Theory} |
| 86 | + In this lecture we are interested in \emph{remembering, using and implementing} Data Structures that are useful in Programming Challenges. It is important to know them at a theoretical level, but please review the 2nd year DS lecture. |
| 87 | + \end{alertblock} |
| 88 | + \begin{alertblock}{Big Number} |
| 89 | + In the past, we used to have a module on Big Number. Today, just use Python. |
| 90 | + \end{alertblock} |
| 91 | +\end{frame} |
0 commit comments