├── 2017 ├── 2017-2nd │ ├── 2-1-correctness │ │ ├── 2-1-correctness.bib │ │ ├── 2-1-correctness.pdf │ │ ├── 2-1-correctness.tex │ │ ├── 2-1-correctness.tex.latexmain │ │ ├── 2-1-preamble.tex │ │ ├── abstract.tex │ │ ├── algs │ │ │ ├── equal.tex │ │ │ └── euclid.tex │ │ ├── figs │ │ │ ├── euclid.jpg │ │ │ └── tony-hoare.jpg │ │ ├── hw-preamble.tex │ │ ├── problems │ │ │ ├── equal.tex │ │ │ └── euclid.tex │ │ ├── tufte-book.cls │ │ ├── tufte-common.def │ │ ├── tufte-handout.cls │ │ └── tufte-preamble.tex │ ├── 2-10-datastructures │ │ ├── 2-10-datastructures.bib │ │ ├── 2-10-datastructures.pdf │ │ ├── 2-10-datastructures.tex │ │ ├── hw-preamble.tex │ │ ├── tufte-book.cls │ │ ├── tufte-common.def │ │ ├── tufte-handout.cls │ │ └── tufte-preamble.tex │ └── 2-2-efficiency │ │ ├── 2-2-efficiency.bib │ │ ├── 2-2-efficiency.pdf │ │ ├── 2-2-efficiency.tex │ │ ├── 2-2-efficiency.tex.latexmain │ │ ├── 2-2-preamble.tex │ │ ├── abstract.tex │ │ ├── algs │ │ ├── convex-diameter-alg.tex │ │ ├── nodes-at-depth-K.tex │ │ ├── nodes-at-depth.tex │ │ ├── sum-at-depth.tex │ │ └── sum-of-depths.tex │ │ ├── figs │ │ ├── non-antipodal │ │ ├── non-antipodal.png │ │ └── pancake-sorting.png │ │ ├── hw-preamble.tex │ │ ├── problems │ │ ├── convex-diameter.tex │ │ ├── sorting-lower-bound.tex │ │ ├── tree-bfs-depth.tex │ │ └── tree-traversal.tex │ │ ├── tufte-book.cls │ │ ├── tufte-common.def │ │ ├── tufte-handout.cls │ │ └── tufte-preamble.tex └── 2017-4th │ ├── 4-0-sample │ ├── 4-0-preamble.tex │ ├── 4-0-sample.bib │ ├── 4-0-sample.pdf │ ├── 4-0-sample.tex │ ├── 4-0-sample.tex.latexmain │ ├── abstract.tex │ ├── algs │ │ ├── equal.tex │ │ └── euclid.tex │ ├── figs │ │ ├── euclid.jpg │ │ └── tony-hoare.jpg │ ├── hw-preamble.tex │ ├── problems │ │ ├── equal.tex │ │ └── euclid.tex │ ├── tufte-book.cls │ ├── tufte-common.def │ ├── tufte-handout.cls │ └── tufte-preamble.tex │ └── README.md ├── 2019 ├── 2019-1 │ ├── 1-0-latex │ │ ├── 1-0-latex.pdf │ │ ├── 1-0-latex.tex │ │ ├── 1-0-latex.tex.latexmain │ │ ├── README.md │ │ ├── figs │ │ │ ├── for-draw.pdf │ │ │ ├── formula.png │ │ │ ├── knuth-reading-tex-book.png │ │ │ ├── lamport.jpg │ │ │ ├── table.png │ │ │ ├── table.svg │ │ │ └── transitive.pdf │ │ ├── hw-preamble.tex │ │ ├── tufte-book.cls │ │ ├── tufte-common.def │ │ ├── tufte-handout.cls │ │ └── tufte-preamble.tex │ ├── 1-1-why │ │ ├── 1-1-why.pdf │ │ ├── 1-1-why.tex │ │ ├── 1-1-why.tex.latexmain │ │ ├── figs │ │ │ ├── recursion-book-cover.jpg │ │ │ ├── recursion-mirror.jpg │ │ │ ├── scale.jpeg │ │ │ └── try.jpg │ │ ├── hw-preamble.tex │ │ ├── tufte-book.cls │ │ ├── tufte-common.def │ │ ├── tufte-handout.cls │ │ └── tufte-preamble.tex │ ├── 1-10-function │ │ ├── 1-10-function.pdf │ │ ├── 1-10-function.tex │ │ ├── 1-10-function.tex.latexmain │ │ ├── README.md │ │ ├── figs │ │ │ ├── AlligatorEggs.png │ │ │ ├── mit-lambda.png │ │ │ └── scheme-logo.jpg │ │ ├── hw-preamble.tex │ │ ├── tufte-book.cls │ │ ├── tufte-common.def │ │ ├── tufte-handout.cls │ │ └── tufte-preamble.tex │ ├── 1-11-infinity │ │ ├── 1-11-infinity.pdf │ │ ├── 1-11-infinity.tex │ │ ├── 1-11-infinity.tex.latexmain │ │ ├── README.md │ │ ├── figs │ │ │ ├── aleph-null.png │ │ │ ├── cantor.jpg │ │ │ └── ordinal-number.png │ │ ├── hw-preamble.tex │ │ ├── tufte-book.cls │ │ ├── tufte-common.def │ │ ├── tufte-handout.cls │ │ └── tufte-preamble.tex │ ├── 1-12-partial-lattice │ │ ├── 1-12-partial-lattice.pdf │ │ ├── 1-12-partial-lattice.tex │ │ ├── 1-12-partial-lattice.tex.latexmain │ │ ├── README.md │ │ ├── figs │ │ │ └── creativity-angles.jpeg │ │ ├── hw-preamble.tex │ │ ├── tufte-book.cls │ │ ├── tufte-common.def │ │ ├── tufte-handout.cls │ │ └── tufte-preamble.tex │ ├── 1-13-boolean-algebra │ │ ├── 1-13-boolean-algebra.pdf │ │ ├── 1-13-boolean-algebra.tex │ │ ├── 1-13-boolean-algebra.tex.latexmain │ │ ├── README.md │ │ ├── figs │ │ │ ├── George-Boole.jpg │ │ │ └── digital.jpeg │ │ ├── hw-preamble.tex │ │ ├── tufte-book.cls │ │ ├── tufte-common.def │ │ ├── tufte-handout.cls │ │ └── tufte-preamble.tex │ ├── 1-2-reasoning │ │ ├── 1-2-reasoning.pdf │ │ ├── 1-2-reasoning.tex │ │ ├── 1-2-reasoning.tex.latexmain │ │ ├── README.md │ │ ├── figs │ │ │ ├── Descartes.jpeg │ │ │ ├── Gentzen.jpg │ │ │ ├── Hilbert.jpeg │ │ │ └── logic-imagination.jpg │ │ ├── hw-preamble.tex │ │ ├── tufte-book.cls │ │ ├── tufte-common.def │ │ ├── tufte-handout.cls │ │ └── tufte-preamble.tex │ ├── 1-3-proof │ │ ├── 1-3-proof.pdf │ │ ├── 1-3-proof.tex │ │ ├── 1-3-proof.tex.latexmain │ │ ├── README.md │ │ ├── figs │ │ │ ├── bent-line-zn.png │ │ │ ├── domino.jpg │ │ │ ├── dominoeffect.png │ │ │ ├── good-will-hunting-counting-trees.jpeg │ │ │ ├── pigeon-hole-principle.png │ │ │ ├── straight-line-ln.png │ │ │ └── zigzag-zzn.png │ │ ├── hw-preamble.tex │ │ ├── tufte-book.cls │ │ ├── tufte-common.def │ │ ├── tufte-handout.cls │ │ └── tufte-preamble.tex │ ├── 1-4-algorithm │ │ ├── 1-4-algorithm.pdf │ │ ├── 1-4-algorithm.tex │ │ ├── 1-4-algorithm.tex.latexmain │ │ ├── README.md │ │ ├── figs │ │ │ ├── algorithm-dict.jpg │ │ │ ├── difficult.jpg │ │ │ ├── knuth-algorithm-believed.jpeg │ │ │ ├── knuth-beauty.jpeg │ │ │ └── knuth-programming-art.jpg │ │ ├── hw-preamble.tex │ │ ├── tufte-book.cls │ │ ├── tufte-common.def │ │ ├── tufte-handout.cls │ │ └── tufte-preamble.tex │ ├── 1-5-data-structure │ │ ├── 1-5-data-structure.pdf │ │ ├── 1-5-data-structure.tex │ │ ├── 1-5-data-structure.tex.latexmain │ │ ├── README.md │ │ ├── figs │ │ │ ├── boring-teachers.jpg │ │ │ ├── data-structure-first.jpg │ │ │ ├── data-structure-linus.png │ │ │ └── smart-data-structures.jpg │ │ ├── hw-preamble.tex │ │ ├── tufte-book.cls │ │ ├── tufte-common.def │ │ ├── tufte-handout.cls │ │ └── tufte-preamble.tex │ ├── 1-6-programming-language │ │ ├── 1-6-programming-language.pdf │ │ ├── 1-6-programming-language.tex │ │ ├── 1-6-programming-language.tex.latexmain │ │ ├── README.md │ │ ├── figs │ │ │ ├── hoare.jpeg │ │ │ └── syntax-semantics.jpeg │ │ ├── hw-preamble.tex │ │ ├── tufte-book.cls │ │ ├── tufte-common.def │ │ ├── tufte-handout.cls │ │ └── tufte-preamble.tex │ ├── 1-7-programming-paradigm │ │ ├── 1-7-programming-paradigm.pdf │ │ ├── 1-7-programming-paradigm.tex │ │ ├── 1-7-programming-paradigm.tex.latexmain │ │ ├── README.md │ │ ├── figs │ │ │ ├── haskell-logo.png │ │ │ ├── haskell-quicksort.jpg │ │ │ └── haskell-side-effects.jpeg │ │ ├── hw-preamble.tex │ │ ├── tufte-book.cls │ │ ├── tufte-common.def │ │ ├── tufte-handout.cls │ │ └── tufte-preamble.tex │ ├── 1-8-set │ │ ├── 1-8-set.pdf │ │ ├── 1-8-set.tex │ │ ├── 1-8-set.tex.latexmain │ │ ├── README.md │ │ ├── figs │ │ │ └── frege.jpg │ │ ├── hw-preamble.tex │ │ ├── tufte-book.cls │ │ ├── tufte-common.def │ │ ├── tufte-handout.cls │ │ └── tufte-preamble.tex │ ├── 1-9-relation │ │ ├── 1-9-relation.pdf │ │ ├── 1-9-relation.tex │ │ ├── 1-9-relation.tex.latexmain │ │ ├── README.md │ │ ├── figs │ │ │ └── wulin-relation.jpeg │ │ ├── hw-preamble.tex │ │ ├── tufte-book.cls │ │ ├── tufte-common.def │ │ ├── tufte-handout.cls │ │ └── tufte-preamble.tex │ ├── Makefile │ └── README.md └── 2019-2 │ ├── 2-1-correctness │ ├── 2-1-correctness.pdf │ ├── 2-1-correctness.tex │ ├── 2-1-correctness.tex.latexmain │ ├── README.md │ ├── hw-preamble.tex │ ├── tufte-book.cls │ ├── tufte-common.def │ ├── tufte-handout.cls │ └── tufte-preamble.tex │ ├── 2-10-data-structures │ ├── 2-10-data-structures.pdf │ ├── 2-10-data-structures.tex │ ├── 2-10-data-structures.tex.latexmain │ ├── README.md │ ├── hw-preamble.tex │ ├── tufte-book.cls │ ├── tufte-common.def │ ├── tufte-handout.cls │ └── tufte-preamble.tex │ ├── 2-11-heapsort │ ├── 2-11-heapsort.pdf │ ├── 2-11-heapsort.tex │ ├── 2-11-heapsort.tex.latexmain │ ├── README.md │ ├── hw-preamble.tex │ ├── tufte-book.cls │ ├── tufte-common.def │ ├── tufte-handout.cls │ └── tufte-preamble.tex │ ├── 2-12-hashing │ ├── 2-12-hashing.pdf │ ├── 2-12-hashing.tex │ ├── 2-12-hashing.tex.latexmain │ ├── README.md │ ├── hw-preamble.tex │ ├── tufte-book.cls │ ├── tufte-common.def │ ├── tufte-handout.cls │ └── tufte-preamble.tex │ ├── 2-13-bst │ ├── 2-13-bst.pdf │ ├── 2-13-bst.tex │ ├── 2-13-bst.tex.latexmain │ ├── README.md │ ├── hw-preamble.tex │ ├── tufte-book.cls │ ├── tufte-common.def │ ├── tufte-handout.cls │ └── tufte-preamble.tex │ ├── 2-14-b-tree │ ├── 2-14-b-tree.pdf │ ├── 2-14-b-tree.tex │ ├── 2-14-b-tree.tex.latexmain │ ├── README.md │ ├── hw-preamble.tex │ ├── tufte-book.cls │ ├── tufte-common.def │ ├── tufte-handout.cls │ └── tufte-preamble.tex │ ├── 2-15-rb-tree │ ├── 2-15-rb-tree.pdf │ ├── 2-15-rb-tree.tex │ ├── 2-15-rb-tree.tex.latexmain │ ├── README.md │ ├── hw-preamble.tex │ ├── tufte-book.cls │ ├── tufte-common.def │ ├── tufte-handout.cls │ └── tufte-preamble.tex │ ├── 2-2-efficiency │ ├── 2-2-efficiency.pdf │ ├── 2-2-efficiency.tex │ ├── 2-2-efficiency.tex.latexmain │ ├── README.md │ ├── hw-preamble.tex │ ├── tufte-book.cls │ ├── tufte-common.def │ ├── tufte-handout.cls │ └── tufte-preamble.tex │ ├── 2-3-counting │ ├── 2-3-counting.pdf │ ├── 2-3-counting.tex │ ├── 2-3-counting.tex.latexmain │ ├── README.md │ ├── algs │ │ └── conundrum.tex │ ├── counting.bib │ ├── figs │ │ └── einstein-count.jpg │ ├── hw-preamble.tex │ ├── tufte-book.cls │ ├── tufte-common.def │ ├── tufte-handout.cls │ └── tufte-preamble.tex │ ├── 2-4-recurrence │ ├── 2-4-recurrence.bib │ ├── 2-4-recurrence.pdf │ ├── 2-4-recurrence.tex │ ├── 2-4-recurrence.tex.latexmain │ ├── README.md │ ├── hw-preamble.tex │ ├── tufte-book.cls │ ├── tufte-common.def │ ├── tufte-handout.cls │ └── tufte-preamble.tex │ ├── 2-5-solving-recurrence │ ├── 2-5-solving-recurrence.bib │ ├── 2-5-solving-recurrence.pdf │ ├── 2-5-solving-recurrence.tex │ ├── 2-5-solving-recurrence.tex.latexmain │ ├── README.md │ ├── hw-preamble.tex │ ├── tufte-book.cls │ ├── tufte-common.def │ ├── tufte-handout.cls │ └── tufte-preamble.tex │ ├── 2-6-algorithmic-methods │ ├── 2-6-algorithmic-methods.pdf │ ├── 2-6-algorithmic-methods.tex │ ├── 2-6-algorithmic-methods.tex.latexmain │ ├── README.md │ ├── hw-preamble.tex │ ├── tufte-book.cls │ ├── tufte-common.def │ ├── tufte-handout.cls │ └── tufte-preamble.tex │ ├── 2-7-discrete-probability │ ├── 2-7-discrete-probability.pdf │ ├── 2-7-discrete-probability.tex │ ├── 2-7-discrete-probability.tex.latexmain │ ├── README.md │ ├── hw-preamble.tex │ ├── tufte-book.cls │ ├── tufte-common.def │ ├── tufte-handout.cls │ └── tufte-preamble.tex │ ├── 2-8-probabilistic-analysis │ ├── 2-8-probabilistic-analysis.pdf │ ├── 2-8-probabilistic-analysis.tex │ ├── 2-8-probabilistic-analysis.tex.latexmain │ ├── README.md │ ├── hw-preamble.tex │ ├── tufte-book.cls │ ├── tufte-common.def │ ├── tufte-handout.cls │ └── tufte-preamble.tex │ ├── 2-9-sorting-selection │ ├── 2-9-sorting-selection.pdf │ ├── 2-9-sorting-selection.tex │ ├── 2-9-sorting-selection.tex.latexmain │ ├── README.md │ ├── hw-preamble.tex │ ├── tufte-book.cls │ ├── tufte-common.def │ ├── tufte-handout.cls │ └── tufte-preamble.tex │ └── 2019-2-correction │ ├── 2019-2-correction.pdf │ ├── 2019-2-correction.tex │ ├── 2019-2-correction.tex.latexmain │ ├── README.md │ ├── hw-preamble.tex │ ├── tufte-book.cls │ ├── tufte-common.def │ ├── tufte-handout.cls │ └── tufte-preamble.tex ├── .github └── ISSUE_TEMPLATE │ └── problem-collecting.md ├── .gitignore ├── LICENSE └── README.md /.github/ISSUE_TEMPLATE/problem-collecting.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: problem-collecting 3 | about: Issue Template for Collecting Problems 4 | title: "[征集题目]+题目关键词" 5 | labels: problem-collecting 6 | assignees: hengxin 7 | 8 | --- 9 | 10 | ***主题:*** 11 | 与哪个/哪些主题相关 12 | 13 | ***题目:*** 14 | 15 | ***习题 还是 OT (在`[]`中填入`x`表示勾选):*** 16 | - [ ] 习题 17 | - [ ] OT 18 | 19 | ***推荐理由:*** 20 | 21 | ***题解:*** 22 | 23 | ***参考资料:*** 24 | 25 | ***其它:*** 26 | -------------------------------------------------------------------------------- /2017/2017-2nd/2-1-correctness/2-1-correctness.bib: -------------------------------------------------------------------------------- 1 | % file: 2-1-correctness.bib 2 | 3 | @article{Hoare:CACM69, 4 | author = {Hoare, C. A. R.}, 5 | title = {An Axiomatic Basis for Computer Programming}, 6 | journal = {Commun. ACM}, 7 | volume = {12}, 8 | number = {10}, 9 | year = {1969}, 10 | pages = {576--580}, 11 | publisher = {ACM}, 12 | } 13 | -------------------------------------------------------------------------------- /2017/2017-2nd/2-1-correctness/2-1-correctness.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2017/2017-2nd/2-1-correctness/2-1-correctness.pdf -------------------------------------------------------------------------------- /2017/2017-2nd/2-1-correctness/2-1-correctness.tex: -------------------------------------------------------------------------------- 1 | \documentclass{tufte-handout} 2 | 3 | \input{tufte-preamble} 4 | \input{hw-preamble} 5 | \input{2-1-preamble} 6 | 7 | \title{2-1 The Correctness of Algorithms\thanks{Wish all your correctness proofs were \uppercase{correct}! May God bless you!}} 8 | \author[hengxin]{Hengfeng Wei {\normalsize (hfwei@nju.edu.cn)}} 9 | \date{13 March 2018 $\sim$ \today{}} 10 | 11 | \begin{document} 12 | \begin{CJK*}{UTF8}{gbsn} 13 | 14 | \maketitle 15 | 16 | \input{abstract} 17 | \input{problems/equal} 18 | \input{problems/euclid} 19 | 20 | \bibliography{2-1-correctness} 21 | \bibliographystyle{plainnat} 22 | 23 | \end{CJK*} 24 | \end{document} -------------------------------------------------------------------------------- /2017/2017-2nd/2-1-correctness/2-1-correctness.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2017/2017-2nd/2-1-correctness/2-1-correctness.tex.latexmain -------------------------------------------------------------------------------- /2017/2017-2nd/2-1-correctness/2-1-preamble.tex: -------------------------------------------------------------------------------- 1 | \newcommand{\euclid}{\textsc{Euclid}} 2 | \newcommand{\equal}{\textsc{Equal}} 3 | -------------------------------------------------------------------------------- /2017/2017-2nd/2-1-correctness/abstract.tex: -------------------------------------------------------------------------------- 1 | % file: abstract.tex 2 | 3 | \begin{abstract} 4 | \noindent We show how to prove the correctness of two algorithms. 5 | One is an iterative algorithm called $\equal(S_1, S_2)$ for comparing two strings. 6 | The other is the classic recursive Euclid algorithm for 7 | computing the greatest common divisor (gcd) of two natural numbers. 8 | \end{abstract} 9 | -------------------------------------------------------------------------------- /2017/2017-2nd/2-1-correctness/algs/equal.tex: -------------------------------------------------------------------------------- 1 | % file: algs/equal.tex 2 | 3 | \begin{algorithm}[t] 4 | \caption{Comparing two strings.} 5 | \label{alg:equal} 6 | \begin{algorithmic}[1] 7 | \Procedure{Equal}{$S_1,S_2$} 8 | \LineComment{\teal{$P: S_1, S_2$ are strings}} 9 | \State $X \gets S_1$ \label{line:init-begin} 10 | \State $Y \gets S_2$ 11 | \State $E \gets \top$ \label{line:init-end} 12 | \hStatex 13 | 14 | \LineComment{\teal{(1) $I: S_1 = S_2 \iff (X = Y \land E = \top)$}} 15 | \While{$X \neq \epsilon \land Y \neq \epsilon \land E = \top$} \label{line:while-loop} 16 | \If{$\texttt{eq}(\texttt{head}(X), \texttt{head}(Y))$} \label{line:while-begin} 17 | \State $X \gets \texttt{tail}(X)$ 18 | \State $Y \gets \texttt{tail}(Y)$ 19 | \Else 20 | \State $E \gets \bot$ 21 | \EndIf \label{line:while-end} 22 | \EndWhile 23 | 24 | \hStatex 25 | \LineComment{\teal{(2) $S_1 = S_2 \iff \big((X = \epsilon \land Y = \epsilon) \land E = \top\big)$}} 26 | \If{$\lnot (X = \epsilon \land Y = \epsilon)$} 27 | \State $E \gets \bot$ 28 | \LineComment{\teal{(3.1) $S_1 \neq S_2 \land E = \bot$}} 29 | \Else 30 | \State \texttt{DoNothing} \Comment{Just for inserting an assertion here.} 31 | \LineComment{\teal{(3.2) $S_1 = S_2 \iff E = \top$}} 32 | \EndIf 33 | 34 | \hStatex 35 | \LineComment{\teal{(4) $Q: S_1 = S_2 \iff E = \top$}} 36 | \State \Return $E$ 37 | \EndProcedure 38 | \end{algorithmic} 39 | \end{algorithm} 40 | -------------------------------------------------------------------------------- /2017/2017-2nd/2-1-correctness/algs/euclid.tex: -------------------------------------------------------------------------------- 1 | % file: algs/euclid.tex 2 | 3 | \begin{algorithm}[h] 4 | \caption{The Euclid Algorithm} 5 | \label{alg:euclid} 6 | \begin{algorithmic}[1] 7 | \Procedure{Euclid}{$m,n$} 8 | \If{$n > 0$} 9 | \State \Return $m$ 10 | \Else 11 | \State \Return \Call{Euclid}{$n, m \bmod n$} 12 | \EndIf 13 | \EndProcedure 14 | \end{algorithmic} 15 | \end{algorithm} 16 | -------------------------------------------------------------------------------- /2017/2017-2nd/2-1-correctness/figs/euclid.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2017/2017-2nd/2-1-correctness/figs/euclid.jpg -------------------------------------------------------------------------------- /2017/2017-2nd/2-1-correctness/figs/tony-hoare.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2017/2017-2nd/2-1-correctness/figs/tony-hoare.jpg -------------------------------------------------------------------------------- /2017/2017-2nd/2-1-correctness/hw-preamble.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % File: hw-preamble.tex 3 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4 | 5 | % Set fonts commands 6 | \newcommand{\song}{\CJKfamily{song}} 7 | \newcommand{\hei}{\CJKfamily{hei}} 8 | \newcommand{\kai}{\CJKfamily{kai}} 9 | \newcommand{\fs}{\CJKfamily{fs}} 10 | 11 | % colors 12 | \newcommand{\red}[1]{\textcolor{red}{#1}} 13 | \newcommand{\blue}[1]{\textcolor{blue}{#1}} 14 | \newcommand{\teal}[1]{\textcolor{teal}{#1}} 15 | 16 | % math 17 | \newcommand{\set}[1]{\{#1\}} 18 | 19 | % For math 20 | \usepackage{amsmath} 21 | 22 | % Define theorem-like environments 23 | \usepackage[amsmath, thmmarks]{ntheorem} 24 | 25 | \theoremstyle{break} 26 | \theorembodyfont{\song} 27 | \theoremseparator{} 28 | \newtheorem*{problem}{Problem} 29 | 30 | \theorempreskip{2.0\topsep} 31 | \theoremheaderfont{\kai\bfseries} 32 | \theoremseparator{:} 33 | \newtheorem*{solution}{Solution} 34 | 35 | \theoremstyle{break} 36 | \theorempostwork{\bigskip\hrule} 37 | \theoremsymbol{\ensuremath{\Box}} 38 | \newtheorem*{proof}{Proof} 39 | 40 | % algorithms 41 | \usepackage[]{algorithm} 42 | \usepackage[noend]{algpseudocode} % noend 43 | % See [Adjust the indentation whithin the algorithmicx-package when a line is broken](https://tex.stackexchange.com/a/68540/23098) 44 | \newcommand{\algparbox}[1]{\parbox[t]{\dimexpr\linewidth-\algorithmicindent}{#1\strut}} 45 | \newcommand{\hStatex}[0]{\vspace{5pt}} 46 | \makeatletter 47 | \newlength{\trianglerightwidth} 48 | \settowidth{\trianglerightwidth}{$\triangleright$~} 49 | \algnewcommand{\LineComment}[1]{\Statex \hskip\ALG@thistlm \(\triangleright\) #1} 50 | \algnewcommand{\LineCommentCont}[1]{\Statex \hskip\ALG@thistlm% 51 | \parbox[t]{\dimexpr\linewidth-\ALG@thistlm}{\hangindent=\trianglerightwidth \hangafter=1 \strut$\triangleright$ #1\strut}} 52 | \makeatother 53 | 54 | % For figures 55 | % for fig with caption: #1: width/size; #2: fig file; #3: fig caption 56 | \newcommand{\fig}[3]{ 57 | \begin{figure}[htp] 58 | \centering 59 | \includegraphics[#1]{#2} 60 | \caption{#3} 61 | \end{figure} 62 | } 63 | 64 | % for fig without caption: #1: width/size; #2: fig file 65 | \newcommand{\fignocaption}[2]{ 66 | \begin{figure}[htp] 67 | \centering 68 | \includegraphics[#1]{#2} 69 | \end{figure} 70 | } -------------------------------------------------------------------------------- /2017/2017-2nd/2-1-correctness/problems/euclid.tex: -------------------------------------------------------------------------------- 1 | % file: problems/euclid.tex 2 | 3 | \section{Extra Problem: $\euclid(m, n)$} \label{section:euclid} 4 | 5 | Prove the recursive Euclid algorithm as shown in Algorithm~\ref{alg:euclid} for 6 | computing the greatest common divisor (gcd) of two natural numbers are totally correct. 7 | 8 | \begin{marginfigure}% 9 | \includegraphics[width=0.60\linewidth]{figs/euclid} 10 | \label{fig:euclid} 11 | \end{marginfigure} 12 | 13 | \input{algs/euclid} 14 | 15 | \subsection{Proof} 16 | 17 | \marginnote{Also pay attention to the way how to write a mathematical induction proof.} 18 | 19 | We prove the partial correctness of \euclid{} by strong mathematical induction on $n$, 20 | with $m$ any fixed natural number. 21 | 22 | \begin{description} 23 | \item[Basis:] $n = 0$. We have that 24 | \marginnote{Make sure you understand each of these three ``='''s: 25 | \begin{enumerate}[(1)] 26 | \item By $n = 0$; 27 | \item By the property of $\gcd$; 28 | \item By the \euclid{} algorithm. 29 | \end{enumerate} 30 | } 31 | \[ 32 | \gcd(m,n) = \gcd(m,0) = m = \euclid(m,0). 33 | \] 34 | \item[Inductive Hypothesis:] 35 | Suppose that $n \ge 1$ and 36 | \[ 37 | \gcd(m, k) = \euclid(m, k), \;\forall 0 \le k \le n - 1. 38 | \] 39 | \item[Inductive Step:] 40 | We need to prove that ($n \ge 1$) 41 | \[ 42 | \gcd(m, n) = \euclid(m, n). 43 | \] 44 | 45 | According to \euclid{}, we have 46 | \[ 47 | \euclid(m,n) = \euclid(n, m \bmod n). 48 | \] 49 | Since $(m \bmod n) < n$, by the inductive hypothesis, we have 50 | \[ 51 | \euclid(n, m \bmod n) = \gcd(n, m \bmod n). 52 | \] 53 | Therefore, it suffices to prove that 54 | \[ 55 | \boxed{\gcd(m,n) = \gcd(n, m \bmod n).} 56 | \] 57 | For notational convenience, we denote 58 | \[ 59 | d = \gcd(m,n), \quad d' = \gcd(n, m \bmod n). 60 | \] 61 | Because $d, d' \ge 0$, it is sufficient to obtain $d = d'$ 62 | by showing that $d \mid d'$ and $d' \mid d$: 63 | 64 | \begin{itemize} 65 | \item $d \mid d'$. 66 | \item $d' \mid d$. 67 | \end{itemize} 68 | \end{description} 69 | -------------------------------------------------------------------------------- /2017/2017-2nd/2-1-correctness/tufte-book.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-book}[2009/12/11 v3.5.0 Tufte-book class] 4 | 5 | %% 6 | % Declare we're tufte-book 7 | \newcommand{\@tufte@class}{book}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-book}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any book-specific stuff now 17 | 18 | %% 19 | % The front matter in Tufte's /Beautiful Evidence/ contains everything up 20 | % to the opening page of Chapter 1. The running heads, when they appear, 21 | % contain only the (arabic) page number in the outside corner. 22 | %\newif\if@mainmatter \@mainmattertrue 23 | \renewcommand\frontmatter{% 24 | \cleardoublepage% 25 | \@mainmatterfalse% 26 | \pagenumbering{arabic}% 27 | %\pagestyle{plain}% 28 | \fancyhf{}% 29 | \ifthenelse{\boolean{@tufte@twoside}}% 30 | {\fancyhead[LE,RO]{\thepage}}% 31 | {\fancyhead[RE,RO]{\thepage}}% 32 | } 33 | 34 | 35 | %% 36 | % The main matter in Tufte's /Beautiful Evidence/ doesn't restart the page 37 | % numbering---it continues where it left off in the front matter. 38 | \renewcommand\mainmatter{% 39 | \cleardoublepage% 40 | \@mainmattertrue% 41 | \fancyhf{}% 42 | \ifthenelse{\boolean{@tufte@twoside}}% 43 | {% two-side 44 | \renewcommand{\chaptermark}[1]{\markboth{##1}{}}% 45 | \fancyhead[LE]{\thepage\quad\smallcaps{\newlinetospace{\plaintitle}}}% book title 46 | \fancyhead[RO]{\smallcaps{\newlinetospace{\leftmark}}\quad\thepage}% chapter title 47 | }% 48 | {% one-side 49 | \fancyhead[RE,RO]{\smallcaps{\newlinetospace{\plaintitle}}\quad\thepage}% book title 50 | }% 51 | } 52 | 53 | 54 | %% 55 | % The back matter contains appendices, indices, glossaries, endnotes, 56 | % biliographies, list of contributors, illustration credits, etc. 57 | \renewcommand\backmatter{% 58 | \if@openright% 59 | \cleardoublepage% 60 | \else% 61 | \clearpage% 62 | \fi% 63 | \@mainmatterfalse% 64 | } 65 | 66 | %% 67 | % Only show the chapter titles in the table of contents 68 | \setcounter{tocdepth}{0} 69 | 70 | %% 71 | % If there is a `tufte-book-local.sty' file, load it. 72 | 73 | \IfFileExists{tufte-book-local.tex} 74 | {\input{tufte-book-local} 75 | \TufteInfoNL{Loading tufte-book-local.tex}} 76 | {} 77 | 78 | %% 79 | % End of file 80 | \endinput 81 | -------------------------------------------------------------------------------- /2017/2017-2nd/2-1-correctness/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2017/2017-2nd/2-1-correctness/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | \usepackage{CJKutf8} 2 | 3 | % \geometry{showframe}% for debugging purposes -- displays the margins 4 | \usepackage{amsmath} 5 | 6 | % Set up the images/graphics package 7 | \usepackage{graphicx} 8 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 9 | % \graphicspath{{figs/}} 10 | 11 | % The following package makes prettier tables. We're all about the bling! 12 | \usepackage{booktabs} 13 | 14 | % The units package provides nice, non-stacked fractions and better spacing for units. 15 | \usepackage{units} 16 | 17 | % The fancyvrb package lets us customize the formatting of verbatim environments. We use a slightly smaller font. 18 | \usepackage{fancyvrb} 19 | \fvset{fontsize=\normalsize} 20 | 21 | % Small sections of multiple columns 22 | \usepackage{multicol} 23 | 24 | % Provides paragraphs of dummy text 25 | \usepackage{lipsum} 26 | 27 | % These commands are used to pretty-print LaTeX commands 28 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 29 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 30 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 31 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 32 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 33 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 34 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 35 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 36 | -------------------------------------------------------------------------------- /2017/2017-2nd/2-10-datastructures/2-10-datastructures.bib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2017/2017-2nd/2-10-datastructures/2-10-datastructures.bib -------------------------------------------------------------------------------- /2017/2017-2nd/2-10-datastructures/2-10-datastructures.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2017/2017-2nd/2-10-datastructures/2-10-datastructures.pdf -------------------------------------------------------------------------------- /2017/2017-2nd/2-10-datastructures/hw-preamble.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % File: hw-preamble.tex 3 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4 | 5 | % Set fonts commands 6 | \newcommand{\song}{\CJKfamily{song}} 7 | \newcommand{\hei}{\CJKfamily{hei}} 8 | \newcommand{\kai}{\CJKfamily{kai}} 9 | \newcommand{\fs}{\CJKfamily{fs}} 10 | 11 | % colors 12 | \newcommand{\red}[1]{\textcolor{red}{#1}} 13 | \newcommand{\blue}[1]{\textcolor{blue}{#1}} 14 | \newcommand{\teal}[1]{\textcolor{teal}{#1}} 15 | 16 | % math 17 | \newcommand{\set}[1]{\{#1\}} 18 | 19 | % For math 20 | \usepackage{amsmath} 21 | 22 | % Define theorem-like environments 23 | \usepackage[amsmath, thmmarks]{ntheorem} 24 | 25 | \theoremstyle{break} 26 | \theorembodyfont{\song} 27 | \theoremseparator{} 28 | \newtheorem*{problem}{Problem} 29 | 30 | \theorempreskip{2.0\topsep} 31 | \theoremheaderfont{\kai\bfseries} 32 | \theoremseparator{:} 33 | \newtheorem*{solution}{Solution} 34 | 35 | \theoremstyle{break} 36 | \theorempostwork{\bigskip\hrule} 37 | \theoremsymbol{\ensuremath{\Box}} 38 | \newtheorem*{proof}{Proof} 39 | 40 | % algorithms 41 | \usepackage[]{algorithm} 42 | \usepackage[noend]{algpseudocode} % noend 43 | % See [Adjust the indentation whithin the algorithmicx-package when a line is broken](https://tex.stackexchange.com/a/68540/23098) 44 | \newcommand{\algparbox}[1]{\parbox[t]{\dimexpr\linewidth-\algorithmicindent}{#1\strut}} 45 | \newcommand{\hStatex}[0]{\vspace{5pt}} 46 | \makeatletter 47 | \newlength{\trianglerightwidth} 48 | \settowidth{\trianglerightwidth}{$\triangleright$~} 49 | \algnewcommand{\LineComment}[1]{\Statex \hskip\ALG@thistlm \(\triangleright\) #1} 50 | \algnewcommand{\LineCommentCont}[1]{\Statex \hskip\ALG@thistlm% 51 | \parbox[t]{\dimexpr\linewidth-\ALG@thistlm}{\hangindent=\trianglerightwidth \hangafter=1 \strut$\triangleright$ #1\strut}} 52 | \makeatother 53 | 54 | % For figures 55 | % for fig with caption: #1: width/size; #2: fig file; #3: fig caption 56 | \newcommand{\fig}[3]{ 57 | \begin{figure}[htp] 58 | \centering 59 | \includegraphics[#1]{#2} 60 | \caption{#3} 61 | \end{figure} 62 | } 63 | 64 | % for fig without caption: #1: width/size; #2: fig file 65 | \newcommand{\fignocaption}[2]{ 66 | \begin{figure}[htp] 67 | \centering 68 | \includegraphics[#1]{#2} 69 | \end{figure} 70 | } -------------------------------------------------------------------------------- /2017/2017-2nd/2-10-datastructures/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2017/2017-2nd/2-10-datastructures/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | \usepackage{CJKutf8} 2 | 3 | % \geometry{showframe}% for debugging purposes -- displays the margins 4 | \usepackage{amsmath} 5 | 6 | % Set up the images/graphics package 7 | \usepackage{graphicx} 8 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 9 | % \graphicspath{{figs/}} 10 | 11 | % The following package makes prettier tables. We're all about the bling! 12 | \usepackage{booktabs} 13 | 14 | % The units package provides nice, non-stacked fractions and better spacing for units. 15 | \usepackage{units} 16 | 17 | % The fancyvrb package lets us customize the formatting of verbatim environments. We use a slightly smaller font. 18 | \usepackage{fancyvrb} 19 | \fvset{fontsize=\normalsize} 20 | 21 | % Small sections of multiple columns 22 | \usepackage{multicol} 23 | 24 | % Provides paragraphs of dummy text 25 | \usepackage{lipsum} 26 | 27 | % These commands are used to pretty-print LaTeX commands 28 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 29 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 30 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 31 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 32 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 33 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 34 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 35 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 36 | -------------------------------------------------------------------------------- /2017/2017-2nd/2-2-efficiency/2-2-efficiency.bib: -------------------------------------------------------------------------------- 1 | % file: 2-2-efficiency.bib 2 | 3 | @article{Gates:DM1979, 4 | author = {Gates, William H. and Papadimitriou, Christos H.}, 5 | title = {Bounds for Sorting by Prefix Reversal}, 6 | journal = {Discrete Math.}, 7 | volume = {27}, 8 | number = {1}, 9 | month = jan, 10 | year = {1979}, 11 | issn = {0012-365X}, 12 | pages = {47--57}, 13 | numpages = {11}, 14 | publisher = {Elsevier Science Publishers B. V.}, 15 | } 16 | 17 | 18 | -------------------------------------------------------------------------------- /2017/2017-2nd/2-2-efficiency/2-2-efficiency.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2017/2017-2nd/2-2-efficiency/2-2-efficiency.pdf -------------------------------------------------------------------------------- /2017/2017-2nd/2-2-efficiency/2-2-efficiency.tex: -------------------------------------------------------------------------------- 1 | \documentclass{tufte-handout} 2 | 3 | \input{tufte-preamble} 4 | \input{hw-preamble} 5 | \input{2-2-preamble} 6 | 7 | \title{2-2 The Efficiency of Algorithms\thanks{}} 8 | \author[hengxin]{Hengfeng Wei {\normalsize (hfwei@nju.edu.cn)}} 9 | \date{16 March 2018 $\sim$ \today{}} 10 | 11 | \begin{document} 12 | \begin{CJK*}{UTF8}{gbsn} 13 | 14 | \maketitle 15 | 16 | \input{abstract} 17 | \input{problems/convex-diameter} 18 | \input{problems/sorting-lower-bound} 19 | \input{problems/tree-bfs-depth} 20 | \input{problems/tree-traversal} 21 | 22 | \bibliography{2-2-efficiency} 23 | \bibliographystyle{plainnat} 24 | 25 | \end{CJK*} 26 | \end{document} -------------------------------------------------------------------------------- /2017/2017-2nd/2-2-efficiency/2-2-efficiency.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2017/2017-2nd/2-2-efficiency/2-2-efficiency.tex.latexmain -------------------------------------------------------------------------------- /2017/2017-2nd/2-2-efficiency/2-2-preamble.tex: -------------------------------------------------------------------------------- 1 | \newcommand{\euclid}{\textsc{Euclid}} 2 | \newcommand{\equal}{\textsc{Equal}} 3 | -------------------------------------------------------------------------------- /2017/2017-2nd/2-2-efficiency/abstract.tex: -------------------------------------------------------------------------------- 1 | % file: abstract.tex 2 | 3 | \begin{abstract} 4 | \noindent 5 | The key points include: 6 | \begin{itemize} 7 | \item Correctness of the rotating caliper algorithm for the convex polygon diameter problem. 8 | \item Lower bound proof of comparison-based sorting. 9 | \item Depth-first and breadth-first traversal of trees. 10 | \end{itemize} 11 | \end{abstract} 12 | -------------------------------------------------------------------------------- /2017/2017-2nd/2-2-efficiency/algs/convex-diameter-alg.tex: -------------------------------------------------------------------------------- 1 | % file: algs/convex-diameter-alg.tex 2 | -------------------------------------------------------------------------------- /2017/2017-2nd/2-2-efficiency/algs/nodes-at-depth-K.tex: -------------------------------------------------------------------------------- 1 | % file: algs/nodes-at-depth-K.tex 2 | % for UD Problem 4.2 (b) 3 | 4 | \begin{algorithm}[t] 5 | \caption{Count the number of nodes in $T$ at depth $K$.} 6 | \label{alg:nodes-at-depth-K} 7 | \begin{algorithmic}[1] 8 | \Procedure{Nodes-at-Depth}{\null} 9 | \State \Return $\Call{Nodes-at-Depth}{T, K}$ 10 | \EndProcedure 11 | 12 | \Statex 13 | \Procedure{Nodes-at-Depth}{$r, k$} \Comment{$r$: root of a tree} 14 | \If{$k = 0$} 15 | \State \Return 1 16 | \Else 17 | \State $num \gets 0$ 18 | \ForAll{child vertex $v$ of $r$} 19 | \State $num \gets num + \Call{Nodes-at-Depth}{v, k - 1}$ 20 | \EndFor 21 | \State \Return $sum$ 22 | \EndIf 23 | \EndProcedure 24 | \end{algorithmic} 25 | \end{algorithm} 26 | -------------------------------------------------------------------------------- /2017/2017-2nd/2-2-efficiency/algs/nodes-at-depth.tex: -------------------------------------------------------------------------------- 1 | % file: algs/nodes-at-depth.tex 2 | % for UD Problem 4.3 (b) 3 | 4 | \begin{algorithm}[t] 5 | \caption{Count the number of nodes of a tree $T$ at each depth.} 6 | \label{alg:nodes-at-depth} 7 | \begin{algorithmic}[1] 8 | \Procedure{Nodes-at-Depth}{$r$} \Comment{$r$: root of the tree $T$} 9 | \State $r.depth \gets 0$ 10 | 11 | \hStatex 12 | \State $Q \gets \emptyset$ 13 | \State $\Call{Enqueue}{Q, r}$ 14 | 15 | \hStatex 16 | \While{$Q \neq \emptyset$} 17 | \State $u \gets \Call{Dequeue}{Q}$ 18 | \State $nodesAtDepth[u.depth] \textsl{\;+=\;} 1$ 19 | 20 | \hStatex 21 | \ForAll{child vertex $v$ of $u$} 22 | \State $v.depth \gets u.depth + 1$ 23 | \State $\Call{Enqueue}{Q, v}$ 24 | \EndFor 25 | \EndWhile 26 | \EndProcedure 27 | \end{algorithmic} 28 | \end{algorithm} 29 | -------------------------------------------------------------------------------- /2017/2017-2nd/2-2-efficiency/algs/sum-at-depth.tex: -------------------------------------------------------------------------------- 1 | % file: algs/sum-at-depth.tex 2 | % for UD Problem 4.3 (a) 3 | 4 | \begin{algorithm}[t] 5 | \caption{Calculate the sum of contents of nodes of a tree $T$ at each depth.} 6 | \label{alg:sum-at-depth} 7 | \begin{algorithmic}[1] 8 | \Procedure{Sum-at-Depth}{$r$} \Comment{$r$: root of the tree $T$} 9 | \State $r.depth \gets 0$ 10 | 11 | \hStatex 12 | \State $Q \gets \emptyset$ 13 | \State $\Call{Enqueue}{Q, r}$ 14 | 15 | \hStatex 16 | \While{$Q \neq \emptyset$} 17 | \State $u \gets \Call{Dequeue}{Q}$ 18 | \State $sumAtDepth[u.depth] \textsl{\;+=\;} u.content$ 19 | 20 | \hStatex 21 | \ForAll{child vertex $v$ of $u$} 22 | \State $v.depth \gets u.depth + 1$ 23 | \State $\Call{Enqueue}{Q, v}$ 24 | \EndFor 25 | \EndWhile 26 | \EndProcedure 27 | \end{algorithmic} 28 | \end{algorithm} 29 | -------------------------------------------------------------------------------- /2017/2017-2nd/2-2-efficiency/algs/sum-of-depths.tex: -------------------------------------------------------------------------------- 1 | % file: algs/sum-of-depths.tex 2 | % for UD Problem 4.2 (a) 3 | 4 | \begin{algorithm}[t] 5 | \caption{Calculate the sum of depths of all nodes of a tree $T$.} 6 | \label{alg:sum-of-depths} 7 | \begin{algorithmic}[1] 8 | \Procedure{Sum-of-Depth}{\null} 9 | \State \Return $\Call{Sum-of-Depth}{T, 0}$ 10 | \EndProcedure 11 | 12 | \Statex 13 | \Procedure{Sum-of-Depth}{$r, depth$} \Comment{$r$: root of a tree} 14 | \If{$T$ is a leaf} 15 | \State \Return $depth$ 16 | \Else 17 | \ForAll{child vertex $v$ of $r$} 18 | \State $depth \gets depth + \Call{Sum-of-Depth}{v, depth + 1}$ 19 | \EndFor 20 | \State \Return $depth$ 21 | \EndIf 22 | \EndProcedure 23 | \end{algorithmic} 24 | \end{algorithm} 25 | -------------------------------------------------------------------------------- /2017/2017-2nd/2-2-efficiency/figs/non-antipodal: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2017/2017-2nd/2-2-efficiency/figs/non-antipodal -------------------------------------------------------------------------------- /2017/2017-2nd/2-2-efficiency/figs/non-antipodal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2017/2017-2nd/2-2-efficiency/figs/non-antipodal.png -------------------------------------------------------------------------------- /2017/2017-2nd/2-2-efficiency/figs/pancake-sorting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2017/2017-2nd/2-2-efficiency/figs/pancake-sorting.png -------------------------------------------------------------------------------- /2017/2017-2nd/2-2-efficiency/hw-preamble.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % File: hw-preamble.tex 3 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4 | 5 | % Set fonts commands 6 | \newcommand{\song}{\CJKfamily{song}} 7 | \newcommand{\hei}{\CJKfamily{hei}} 8 | \newcommand{\kai}{\CJKfamily{kai}} 9 | \newcommand{\fs}{\CJKfamily{fs}} 10 | 11 | % colors 12 | \newcommand{\red}[1]{\textcolor{red}{#1}} 13 | \newcommand{\blue}[1]{\textcolor{blue}{#1}} 14 | \newcommand{\teal}[1]{\textcolor{teal}{#1}} 15 | 16 | % math 17 | \newcommand{\set}[1]{\{#1\}} 18 | 19 | % For math 20 | \usepackage{amsmath} 21 | 22 | % Define theorem-like environments 23 | \usepackage[amsmath, thmmarks]{ntheorem} 24 | \newtheorem{definition}{Definition} 25 | \newtheorem{theorem}{Theorem} 26 | \newtheorem{fact}{Fact} 27 | 28 | \theoremstyle{break} 29 | \theorembodyfont{\song} 30 | \theoremseparator{} 31 | \newtheorem*{problem}{Problem} 32 | 33 | \theorempreskip{2.0\topsep} 34 | \theoremheaderfont{\kai\bfseries} 35 | \newtheorem*{solution}{Solution} 36 | \newtheorem{claim}{Claim} 37 | 38 | \theoremstyle{break} 39 | \theoremheaderfont{\kai\bfseries} 40 | \theoremsymbol{\ensuremath{\Box}} 41 | \newtheorem*{proof}{Proof} 42 | 43 | % algorithms 44 | \usepackage[]{algorithm} 45 | \usepackage[noend]{algpseudocode} % noend 46 | % See [Adjust the indentation whithin the algorithmicx-package when a line is broken](https://tex.stackexchange.com/a/68540/23098) 47 | \newcommand{\algparbox}[1]{\parbox[t]{\dimexpr\linewidth-\algorithmicindent}{#1\strut}} 48 | \newcommand{\hStatex}[0]{\vspace{5pt}} 49 | \makeatletter 50 | \newlength{\trianglerightwidth} 51 | \settowidth{\trianglerightwidth}{$\triangleright$~} 52 | \algnewcommand{\LineComment}[1]{\Statex \hskip\ALG@thistlm \(\triangleright\) #1} 53 | \algnewcommand{\LineCommentCont}[1]{\Statex \hskip\ALG@thistlm% 54 | \parbox[t]{\dimexpr\linewidth-\ALG@thistlm}{\hangindent=\trianglerightwidth \hangafter=1 \strut$\triangleright$ #1\strut}} 55 | \makeatother 56 | 57 | % For figures 58 | % for fig with caption: #1: width/size; #2: fig file; #3: fig caption 59 | \newcommand{\fig}[3]{ 60 | \begin{figure}[htp] 61 | \centering 62 | \includegraphics[#1]{#2} 63 | \caption{#3} 64 | \end{figure} 65 | } 66 | 67 | % for fig without caption: #1: width/size; #2: fig file 68 | \newcommand{\fignocaption}[2]{ 69 | \begin{figure}[htp] 70 | \centering 71 | \includegraphics[#1]{#2} 72 | \end{figure} 73 | } -------------------------------------------------------------------------------- /2017/2017-2nd/2-2-efficiency/problems/convex-diameter.tex: -------------------------------------------------------------------------------- 1 | % file: problems/convex-diameter.tex 2 | 3 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4 | \section{The Convex Polygon Diameter Problem} \label{section:convex-diameter} 5 | 6 | %%%%%%%%%%%%%%%%%%%% 7 | \subsection{Solution} 8 | 9 | %%%%%%%%%%%%%%% 10 | \begin{theorem} 11 | For a convex polygon, a pair of vertices determine the diameter. 12 | \end{theorem} 13 | %%%%%%%%%%%%%%% 14 | 15 | %%%%%%%%%%%%%%% 16 | \begin{proof} 17 | \end{proof} 18 | %%%%%%%%%%%%%%% 19 | 20 | %%%%%%%%%%%%%%% 21 | \begin{definition}[Line of Support] 22 | \end{definition} 23 | %%%%%%%%%%%%%%% 24 | 25 | %%%%%%%%%%%%%%% 26 | \begin{definition}[Antipodal] 27 | \end{definition} 28 | %%%%%%%%%%%%%%% 29 | 30 | %%%%%%%%%%%%%%% 31 | \begin{fact} 32 | Not all vertex pairs are antipodal. 33 | \end{fact} 34 | %%%%%%%%%%%%%%% 35 | 36 | %%%%%%%%%%%%%%% 37 | \begin{proof} 38 | \end{proof} 39 | %%%%%%%%%%%%%%% 40 | 41 | %%%%%%%%%%%%%%% 42 | \begin{theorem}[Yaglom] 43 | The diameter of a convex polygon is the greatest distance between parallel lines of support. 44 | \end{theorem} 45 | %%%%%%%%%%%%%%% 46 | 47 | %%%%%%%%%%%%%%% 48 | \begin{proof} 49 | \end{proof} 50 | %%%%%%%%%%%%%%% 51 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 52 | -------------------------------------------------------------------------------- /2017/2017-2nd/2-2-efficiency/problems/sorting-lower-bound.tex: -------------------------------------------------------------------------------- 1 | % file: problems/sorting-lower-bound.tex 2 | 3 | \section{Lower Bound for Comparison-based Sorting (UD Problem 6.13)} 4 | 5 | Prove a lower bound of $O(n \lg n)$ on the time complexity of any comparison-based sorting algorithm. 6 | 7 | \subsection{Understanding the Problem} 8 | 9 | First of all, this problem is \emph{flawed}, if not wrong. 10 | \marginnote{I am not surprised at all if you are good at proving something wrong to be a theorem.} 11 | It should be $\Omega(n \lg n)$, instead of $O(n \lg n)$. 12 | 13 | {\bf Comparison-based Sorting.} 14 | 15 | \begin{itemize} 16 | \item We only consider the sorting algorithms in which 17 | \marginnote{Counting sort, radix sort, or bucket sort is not a comparison-based sorting algorithm.} 18 | comparison is the only way to obtain order information between elements; and 19 | \item Comparisons of elements are the critical operations we care about. 20 | \marginnote{In \href{https://en.wikipedia.org/wiki/Pancake\_sorting}{pancake sorting}, 21 | we are interested in the minimum number of flips (or technically, prefix reversals).\cite{Gates:DM1979}} 22 | \end{itemize} 23 | 24 | {\bf Time complexity $O(n \lg n)$.} Algorithms on the inputs of size $n$. 25 | 26 | \subsection{Solution} 27 | 28 | \subsection{Comments} 29 | -------------------------------------------------------------------------------- /2017/2017-2nd/2-2-efficiency/problems/tree-bfs-depth.tex: -------------------------------------------------------------------------------- 1 | % file: problems/tree-bfs-depth.tex 2 | 3 | \section{BFS on Tree (UD Problem 4.3)} 4 | 5 | Write algorithms that solve the following problems by performing \emph{breadth-first traversals} of the given trees. 6 | You may assume the availability of a queue $Q$. 7 | The operations on $Q$ include adding an item to the rear, 8 | retrieving and removing an item from the front, and testing $Q$ for emptiness. 9 | 10 | \begin{enumerate}[(a)] 11 | \item Given a tree $T$ whose nodes contain integers, 12 | print a list consisting of the sum of contents of nodes at depth 0, 13 | the sum of contents of nodes at depth 1, etc. 14 | \item Given a tree $T$, find the depth $K$ with the maximal number of nodes in $T$. 15 | If there are several such $K$s, return their maximum. 16 | \end{enumerate} 17 | 18 | \subsection{Solution} 19 | 20 | \input{algs/sum-at-depth} 21 | \input{algs/nodes-at-depth} 22 | 23 | -------------------------------------------------------------------------------- /2017/2017-2nd/2-2-efficiency/problems/tree-traversal.tex: -------------------------------------------------------------------------------- 1 | % file: problems/tree-traversal.tex 2 | 3 | \section{Tree Traversal (UD Problem 4.2)} 4 | 5 | \begin{enumerate}[(a)] 6 | \item Write an algorithm which, given a tree $T$, 7 | calculates the sum of the depths of all the nodes of $T$. 8 | \item Write an algorithm which, given a tree $T$ and a positive integer $K$, 9 | calculates the number of nodes in $T$ at depth $K$. 10 | \item Write an algorithm which, given a tree $T$, 11 | checks whether it has any leaf at an even depth. 12 | \end{enumerate} 13 | 14 | \subsection{Solution} 15 | 16 | \input{algs/sum-of-depths} 17 | \input{algs/nodes-at-depth-K} 18 | -------------------------------------------------------------------------------- /2017/2017-2nd/2-2-efficiency/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2017/2017-2nd/2-2-efficiency/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | \usepackage{CJKutf8} 2 | 3 | % \geometry{showframe}% for debugging purposes -- displays the margins 4 | \usepackage{amsmath} 5 | 6 | % Set up the images/graphics package 7 | \usepackage{graphicx} 8 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 9 | % \graphicspath{{figs/}} 10 | 11 | % The following package makes prettier tables. We're all about the bling! 12 | \usepackage{booktabs} 13 | 14 | % The units package provides nice, non-stacked fractions and better spacing for units. 15 | \usepackage{units} 16 | 17 | % The fancyvrb package lets us customize the formatting of verbatim environments. We use a slightly smaller font. 18 | \usepackage{fancyvrb} 19 | \fvset{fontsize=\normalsize} 20 | 21 | % Small sections of multiple columns 22 | \usepackage{multicol} 23 | 24 | % Provides paragraphs of dummy text 25 | \usepackage{lipsum} 26 | 27 | % These commands are used to pretty-print LaTeX commands 28 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 29 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 30 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 31 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 32 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 33 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 34 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 35 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 36 | -------------------------------------------------------------------------------- /2017/2017-4th/4-0-sample/4-0-preamble.tex: -------------------------------------------------------------------------------- 1 | \newcommand{\euclid}{\textsc{Euclid}} 2 | \newcommand{\equal}{\textsc{Equal}} 3 | -------------------------------------------------------------------------------- /2017/2017-4th/4-0-sample/4-0-sample.bib: -------------------------------------------------------------------------------- 1 | % file: 2-1-correctness.bib 2 | 3 | @book{DH, 4 | author = {Harel, David}, 5 | title = {Algorithmics: The Spirit of Computing}, 6 | year = {1987}, 7 | isbn = {0-201-19240-3}, 8 | publisher = {Addison-Wesley Longman Publishing Co., Inc.}, 9 | address = {Boston, MA, USA}, 10 | } 11 | 12 | @article{Hoare:CACM69, 13 | author = {Hoare, C. A. R.}, 14 | title = {An Axiomatic Basis for Computer Programming}, 15 | journal = {Commun. ACM}, 16 | volume = {12}, 17 | number = {10}, 18 | year = {1969}, 19 | pages = {576--580}, 20 | publisher = {ACM}, 21 | } 22 | -------------------------------------------------------------------------------- /2017/2017-4th/4-0-sample/4-0-sample.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2017/2017-4th/4-0-sample/4-0-sample.pdf -------------------------------------------------------------------------------- /2017/2017-4th/4-0-sample/4-0-sample.tex: -------------------------------------------------------------------------------- 1 | \documentclass{tufte-handout} 2 | 3 | \input{tufte-preamble} 4 | \input{hw-preamble} 5 | \input{4-0-preamble} 6 | 7 | \title{4-0 The Correctness of Algorithms\thanks{Wish all your correctness proofs were \uppercase{correct}! May God bless you!}} 8 | \author[hengxin]{Hengfeng Wei {\normalsize (hfwei@nju.edu.cn)}} 9 | \date{May 09, 2019} 10 | 11 | \begin{document} 12 | \begin{CJK*}{UTF8}{gbsn} 13 | 14 | \maketitle 15 | 16 | \input{abstract} 17 | \input{problems/equal} 18 | \input{problems/euclid} 19 | 20 | \bibliography{4-0-sample} 21 | \bibliographystyle{plainnat} 22 | 23 | \end{CJK*} 24 | \end{document} -------------------------------------------------------------------------------- /2017/2017-4th/4-0-sample/4-0-sample.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2017/2017-4th/4-0-sample/4-0-sample.tex.latexmain -------------------------------------------------------------------------------- /2017/2017-4th/4-0-sample/abstract.tex: -------------------------------------------------------------------------------- 1 | % file: abstract.tex 2 | 3 | \begin{abstract} 4 | \noindent We show how to prove the correctness of two algorithms. 5 | One is an iterative algorithm called $\equal(S_1, S_2)$ for comparing two strings. 6 | The other is the classic recursive Euclid algorithm for 7 | computing the greatest common divisor (gcd) of two natural numbers. 8 | \end{abstract} 9 | -------------------------------------------------------------------------------- /2017/2017-4th/4-0-sample/algs/equal.tex: -------------------------------------------------------------------------------- 1 | % file: algs/equal.tex 2 | 3 | \begin{algorithm}[t] 4 | \caption{Comparing two strings.} 5 | \label{alg:equal} 6 | \begin{algorithmic}[1] 7 | \Procedure{Equal}{$S_1,S_2$} 8 | \LineComment{\teal{$P: S_1, S_2$ are strings}} 9 | \State $X \gets S_1$ \label{line:init-begin} 10 | \State $Y \gets S_2$ 11 | \State $E \gets \top$ \label{line:init-end} 12 | \hStatex 13 | 14 | \LineComment{\teal{(1) $I: S_1 = S_2 \iff (X = Y \land E = \top)$}} 15 | \While{$X \neq \epsilon \land Y \neq \epsilon \land E = \top$} \label{line:while-loop} 16 | \If{$\texttt{eq}(\texttt{head}(X), \texttt{head}(Y))$} \label{line:while-begin} 17 | \State $X \gets \texttt{tail}(X)$ 18 | \State $Y \gets \texttt{tail}(Y)$ 19 | \Else 20 | \State $E \gets \bot$ 21 | \EndIf \label{line:while-end} 22 | \EndWhile 23 | 24 | \hStatex 25 | \LineComment{\teal{(2) $S_1 = S_2 \iff \big((X = \epsilon \land Y = \epsilon) \land E = \top\big)$}} 26 | \If{$\lnot (X = \epsilon \land Y = \epsilon)$} 27 | \State $E \gets \bot$ 28 | \LineComment{\teal{(3.1) $S_1 \neq S_2 \land E = \bot$}} 29 | \Else 30 | \State \texttt{DoNothing} \Comment{Just for inserting an assertion here.} 31 | \LineComment{\teal{(3.2) $S_1 = S_2 \iff E = \top$}} 32 | \EndIf 33 | 34 | \hStatex 35 | \LineComment{\teal{(4) $Q: S_1 = S_2 \iff E = \top$}} 36 | \State \Return $E$ 37 | \EndProcedure 38 | \end{algorithmic} 39 | \end{algorithm} 40 | -------------------------------------------------------------------------------- /2017/2017-4th/4-0-sample/algs/euclid.tex: -------------------------------------------------------------------------------- 1 | % file: algs/euclid.tex 2 | 3 | \begin{algorithm}[h] 4 | \caption{The Euclid Algorithm} 5 | \label{alg:euclid} 6 | \begin{algorithmic}[1] 7 | \Procedure{Euclid}{$m,n$} 8 | \If{$n > 0$} 9 | \State \Return $m$ 10 | \Else 11 | \State \Return \Call{Euclid}{$n, m \bmod n$} 12 | \EndIf 13 | \EndProcedure 14 | \end{algorithmic} 15 | \end{algorithm} 16 | -------------------------------------------------------------------------------- /2017/2017-4th/4-0-sample/figs/euclid.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2017/2017-4th/4-0-sample/figs/euclid.jpg -------------------------------------------------------------------------------- /2017/2017-4th/4-0-sample/figs/tony-hoare.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2017/2017-4th/4-0-sample/figs/tony-hoare.jpg -------------------------------------------------------------------------------- /2017/2017-4th/4-0-sample/hw-preamble.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % File: hw-preamble.tex 3 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4 | 5 | % Set fonts commands 6 | \newcommand{\song}{\CJKfamily{song}} 7 | \newcommand{\hei}{\CJKfamily{hei}} 8 | \newcommand{\kai}{\CJKfamily{kai}} 9 | \newcommand{\fs}{\CJKfamily{fs}} 10 | 11 | % colors 12 | \newcommand{\red}[1]{\textcolor{red}{#1}} 13 | \newcommand{\blue}[1]{\textcolor{blue}{#1}} 14 | \newcommand{\teal}[1]{\textcolor{teal}{#1}} 15 | 16 | % math 17 | \newcommand{\set}[1]{\{#1\}} 18 | 19 | % For math 20 | \usepackage{mathtools, amsfonts} 21 | 22 | % Define theorem-like environments 23 | \usepackage[amsmath, thmmarks]{ntheorem} 24 | 25 | \theoremstyle{break} 26 | \theorembodyfont{\song} 27 | \theoremseparator{} 28 | \newtheorem*{problem}{Problem} 29 | 30 | \theorempreskip{2.0\topsep} 31 | \theoremheaderfont{\kai\bfseries} 32 | \theoremseparator{:} 33 | \newtheorem*{solution}{Solution} 34 | 35 | \theoremstyle{break} 36 | \theorempostwork{\bigskip\hrule} 37 | \theoremsymbol{\ensuremath{\Box}} 38 | \newtheorem*{proof}{Proof} 39 | 40 | % algorithms 41 | \usepackage[]{algorithm} 42 | \usepackage[noend]{algpseudocode} % noend 43 | % See [Adjust the indentation whithin the algorithmicx-package when a line is broken](https://tex.stackexchange.com/a/68540/23098) 44 | \newcommand{\algparbox}[1]{\parbox[t]{\dimexpr\linewidth-\algorithmicindent}{#1\strut}} 45 | \newcommand{\hStatex}[0]{\vspace{5pt}} 46 | \makeatletter 47 | \newlength{\trianglerightwidth} 48 | \settowidth{\trianglerightwidth}{$\triangleright$~} 49 | \algnewcommand{\LineComment}[1]{\Statex \hskip\ALG@thistlm \(\triangleright\) #1} 50 | \algnewcommand{\LineCommentCont}[1]{\Statex \hskip\ALG@thistlm% 51 | \parbox[t]{\dimexpr\linewidth-\ALG@thistlm}{\hangindent=\trianglerightwidth \hangafter=1 \strut$\triangleright$ #1\strut}} 52 | \makeatother 53 | 54 | % For figures 55 | % for fig with caption: #1: width/size; #2: fig file; #3: fig caption 56 | \newcommand{\fig}[3]{ 57 | \begin{figure}[htp] 58 | \centering 59 | \includegraphics[#1]{#2} 60 | \caption{#3} 61 | \end{figure} 62 | } 63 | 64 | % for fig without caption: #1: width/size; #2: fig file 65 | \newcommand{\fignocaption}[2]{ 66 | \begin{figure}[htp] 67 | \centering 68 | \includegraphics[#1]{#2} 69 | \end{figure} 70 | } -------------------------------------------------------------------------------- /2017/2017-4th/4-0-sample/problems/euclid.tex: -------------------------------------------------------------------------------- 1 | % file: problems/euclid.tex 2 | 3 | \section{Extra Problem: $\euclid(m, n)$} \label{section:euclid} 4 | 5 | Prove the recursive Euclid algorithm as shown in Algorithm~\ref{alg:euclid} for 6 | computing the greatest common divisor (gcd) of two natural numbers are totally correct. 7 | 8 | \begin{marginfigure}% 9 | \includegraphics[width=0.60\linewidth]{figs/euclid} 10 | \label{fig:euclid} 11 | \end{marginfigure} 12 | 13 | \input{algs/euclid} 14 | 15 | \subsection{Proof} 16 | 17 | \marginnote{Also pay attention to the way how to write a mathematical induction proof.} 18 | 19 | We prove the partial correctness of \euclid{} by strong mathematical induction on $n$, 20 | with $m$ any fixed natural number. 21 | 22 | \begin{description} 23 | \item[Basis:] $n = 0$. We have that 24 | \marginnote{Make sure you understand each of these three ``='''s: 25 | \begin{enumerate}[(1)] 26 | \item By $n = 0$; 27 | \item By the property of $\gcd$; 28 | \item By the \euclid{} algorithm. 29 | \end{enumerate} 30 | } 31 | \[ 32 | \gcd(m,n) = \gcd(m,0) = m = \euclid(m,0). 33 | \] 34 | \item[Inductive Hypothesis:] 35 | Suppose that $n \ge 1$ and 36 | \[ 37 | \gcd(m, k) = \euclid(m, k), \;\forall 0 \le k \le n - 1. 38 | \] 39 | \item[Inductive Step:] 40 | We need to prove that ($n \ge 1$) 41 | \[ 42 | \gcd(m, n) = \euclid(m, n). 43 | \] 44 | 45 | According to \euclid{}, we have 46 | \[ 47 | \euclid(m,n) = \euclid(n, m \bmod n). 48 | \] 49 | Since $(m \bmod n) < n$, by the inductive hypothesis, we have 50 | \[ 51 | \euclid(n, m \bmod n) = \gcd(n, m \bmod n). 52 | \] 53 | Therefore, it suffices to prove that 54 | \[ 55 | \boxed{\gcd(m,n) = \gcd(n, m \bmod n).} 56 | \] 57 | For notational convenience, we denote 58 | \[ 59 | d = \gcd(m,n), \quad d' = \gcd(n, m \bmod n). 60 | \] 61 | Because $d, d' \ge 0$, it is sufficient to obtain $d = d'$ 62 | by showing that $d \mid d'$ and $d' \mid d$: 63 | 64 | \begin{itemize} 65 | \item $d \mid d'$. 66 | \item $d' \mid d$. 67 | \end{itemize} 68 | \end{description} 69 | -------------------------------------------------------------------------------- /2017/2017-4th/4-0-sample/tufte-book.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-book}[2009/12/11 v3.5.0 Tufte-book class] 4 | 5 | %% 6 | % Declare we're tufte-book 7 | \newcommand{\@tufte@class}{book}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-book}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any book-specific stuff now 17 | 18 | %% 19 | % The front matter in Tufte's /Beautiful Evidence/ contains everything up 20 | % to the opening page of Chapter 1. The running heads, when they appear, 21 | % contain only the (arabic) page number in the outside corner. 22 | %\newif\if@mainmatter \@mainmattertrue 23 | \renewcommand\frontmatter{% 24 | \cleardoublepage% 25 | \@mainmatterfalse% 26 | \pagenumbering{arabic}% 27 | %\pagestyle{plain}% 28 | \fancyhf{}% 29 | \ifthenelse{\boolean{@tufte@twoside}}% 30 | {\fancyhead[LE,RO]{\thepage}}% 31 | {\fancyhead[RE,RO]{\thepage}}% 32 | } 33 | 34 | 35 | %% 36 | % The main matter in Tufte's /Beautiful Evidence/ doesn't restart the page 37 | % numbering---it continues where it left off in the front matter. 38 | \renewcommand\mainmatter{% 39 | \cleardoublepage% 40 | \@mainmattertrue% 41 | \fancyhf{}% 42 | \ifthenelse{\boolean{@tufte@twoside}}% 43 | {% two-side 44 | \renewcommand{\chaptermark}[1]{\markboth{##1}{}}% 45 | \fancyhead[LE]{\thepage\quad\smallcaps{\newlinetospace{\plaintitle}}}% book title 46 | \fancyhead[RO]{\smallcaps{\newlinetospace{\leftmark}}\quad\thepage}% chapter title 47 | }% 48 | {% one-side 49 | \fancyhead[RE,RO]{\smallcaps{\newlinetospace{\plaintitle}}\quad\thepage}% book title 50 | }% 51 | } 52 | 53 | 54 | %% 55 | % The back matter contains appendices, indices, glossaries, endnotes, 56 | % biliographies, list of contributors, illustration credits, etc. 57 | \renewcommand\backmatter{% 58 | \if@openright% 59 | \cleardoublepage% 60 | \else% 61 | \clearpage% 62 | \fi% 63 | \@mainmatterfalse% 64 | } 65 | 66 | %% 67 | % Only show the chapter titles in the table of contents 68 | \setcounter{tocdepth}{0} 69 | 70 | %% 71 | % If there is a `tufte-book-local.sty' file, load it. 72 | 73 | \IfFileExists{tufte-book-local.tex} 74 | {\input{tufte-book-local} 75 | \TufteInfoNL{Loading tufte-book-local.tex}} 76 | {} 77 | 78 | %% 79 | % End of file 80 | \endinput 81 | -------------------------------------------------------------------------------- /2017/2017-4th/4-0-sample/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2017/2017-4th/4-0-sample/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | \usepackage{CJKutf8} 2 | 3 | % \geometry{showframe}% for debugging purposes -- displays the margins 4 | \usepackage{amsmath} 5 | 6 | % Set up the images/graphics package 7 | \usepackage{graphicx} 8 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 9 | % \graphicspath{{figs/}} 10 | 11 | % The following package makes prettier tables. We're all about the bling! 12 | \usepackage{booktabs} 13 | 14 | % The units package provides nice, non-stacked fractions and better spacing for units. 15 | \usepackage{units} 16 | 17 | % The fancyvrb package lets us customize the formatting of verbatim environments. We use a slightly smaller font. 18 | \usepackage{fancyvrb} 19 | \fvset{fontsize=\normalsize} 20 | 21 | % Small sections of multiple columns 22 | \usepackage{multicol} 23 | 24 | % Provides paragraphs of dummy text 25 | \usepackage{lipsum} 26 | 27 | % These commands are used to pretty-print LaTeX commands 28 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 29 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 30 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 31 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 32 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 33 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 34 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 35 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 36 | -------------------------------------------------------------------------------- /2017/2017-4th/README.md: -------------------------------------------------------------------------------- 1 | # 2017-4th 2 | 3 | Using `pdflatex`! 4 | -------------------------------------------------------------------------------- /2019/2019-1/1-0-latex/1-0-latex.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-0-latex/1-0-latex.pdf -------------------------------------------------------------------------------- /2019/2019-1/1-0-latex/1-0-latex.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-0-latex/1-0-latex.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-1/1-0-latex/README.md: -------------------------------------------------------------------------------- 1 | # 1-0-latex 2 | 3 | ## 编译 4 | 使用 `XeLaTeX` 编译 `1-0-latex.tex` 文件。 5 | 6 | 如果遇到 "PDF 文件写入权限" 问题, 7 | 很可能是因为你使用的 PDF 阅读器不支持自动更新。 8 | 9 | 两种可能的解决方法: 10 | - 仅使用编辑器内置的 PDF 阅读器打开 `1-0-latex.pdf`。 11 | (如果你用其它阅读器打开了 `1-0-latex.pdf`,需要先关闭。) 12 | - 使用 [Sumatra PDF](https://download.cnet.com/Sumatra-PDF/3000-18497_4-10698785.html) 阅读器。 13 | 14 | 15 | ## 目录结构 16 | - `1-0-latex.tex`: 17 | 18 | 主文件 (main file)。一般来讲,在做作业的时候,你只需要修改、编译该文件。 19 | - `1-0-latex.pdf`: 20 | 21 | 主文件编译后生成的 PDF 文件。也是你需要提交的文件。 22 | - `hw-preamble.tex`: 23 | 24 | 这个文件主要用于导入包、定义命令、定义环境、定义格式等。 25 | 主文件里导入 (`input`) 了该文件。 26 | 27 | 如果你想自定义作业模板,可以修改该文件;否则,可以忽略该文件。 28 | - `1-0-latex.tex.latexmain`: 空文件。 29 | 30 | 仅对使用 Vim LatexSuite 插件的同学有用,如果不用 Vim 编辑器,可忽略该文件。 31 | 32 | 它表示 `1-0-latex.tex` 是主文件。 33 | 34 | 设置主文件的好处是,你不必在每次需要编译的时候,都要切换到 `1-0-latex.tex` 文件。 35 | 同时也避免不小心编译了一个无法编译的非完全的 `.tex` 文件 (比如 `hw-preamble.tex`), 36 | 导致一堆编译错误。 37 | 38 | LaTeX 编辑器一般都有"设置某个文件为主文件"的功能,这个需要大家摸索一下。 39 | - `tufte-book.cls`、`tufte-common.def`、`tufte-handout.cls`、`tufte-preamble.tex`: 40 | 41 | 这是与 `tufte` 格式相关的文件。 42 | 本作业模板是基于 `tufte-handout.cls` 43 | (`tufte-book.cls` 是用来写书的,这里没有用到; `tufte-preamble.tex` 暂时也没有用到) 修改的。 44 | 除非你清楚地知道自己在做什么,否则不要修改这些文件 (尤其是 `tufte-common.def` 与 `tufte-handout.cls`)。 45 | -------------------------------------------------------------------------------- /2019/2019-1/1-0-latex/figs/for-draw.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-0-latex/figs/for-draw.pdf -------------------------------------------------------------------------------- /2019/2019-1/1-0-latex/figs/formula.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-0-latex/figs/formula.png -------------------------------------------------------------------------------- /2019/2019-1/1-0-latex/figs/knuth-reading-tex-book.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-0-latex/figs/knuth-reading-tex-book.png -------------------------------------------------------------------------------- /2019/2019-1/1-0-latex/figs/lamport.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-0-latex/figs/lamport.jpg -------------------------------------------------------------------------------- /2019/2019-1/1-0-latex/figs/table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-0-latex/figs/table.png -------------------------------------------------------------------------------- /2019/2019-1/1-0-latex/figs/transitive.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-0-latex/figs/transitive.pdf -------------------------------------------------------------------------------- /2019/2019-1/1-0-latex/tufte-book.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-book}[2009/12/11 v3.5.0 Tufte-book class] 4 | 5 | %% 6 | % Declare we're tufte-book 7 | \newcommand{\@tufte@class}{book}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-book}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any book-specific stuff now 17 | 18 | %% 19 | % The front matter in Tufte's /Beautiful Evidence/ contains everything up 20 | % to the opening page of Chapter 1. The running heads, when they appear, 21 | % contain only the (arabic) page number in the outside corner. 22 | %\newif\if@mainmatter \@mainmattertrue 23 | \renewcommand\frontmatter{% 24 | \cleardoublepage% 25 | \@mainmatterfalse% 26 | \pagenumbering{arabic}% 27 | %\pagestyle{plain}% 28 | \fancyhf{}% 29 | \ifthenelse{\boolean{@tufte@twoside}}% 30 | {\fancyhead[LE,RO]{\thepage}}% 31 | {\fancyhead[RE,RO]{\thepage}}% 32 | } 33 | 34 | 35 | %% 36 | % The main matter in Tufte's /Beautiful Evidence/ doesn't restart the page 37 | % numbering---it continues where it left off in the front matter. 38 | \renewcommand\mainmatter{% 39 | \cleardoublepage% 40 | \@mainmattertrue% 41 | \fancyhf{}% 42 | \ifthenelse{\boolean{@tufte@twoside}}% 43 | {% two-side 44 | \renewcommand{\chaptermark}[1]{\markboth{##1}{}}% 45 | \fancyhead[LE]{\thepage\quad\smallcaps{\newlinetospace{\plaintitle}}}% book title 46 | \fancyhead[RO]{\smallcaps{\newlinetospace{\leftmark}}\quad\thepage}% chapter title 47 | }% 48 | {% one-side 49 | \fancyhead[RE,RO]{\smallcaps{\newlinetospace{\plaintitle}}\quad\thepage}% book title 50 | }% 51 | } 52 | 53 | 54 | %% 55 | % The back matter contains appendices, indices, glossaries, endnotes, 56 | % biliographies, list of contributors, illustration credits, etc. 57 | \renewcommand\backmatter{% 58 | \if@openright% 59 | \cleardoublepage% 60 | \else% 61 | \clearpage% 62 | \fi% 63 | \@mainmatterfalse% 64 | } 65 | 66 | %% 67 | % Only show the chapter titles in the table of contents 68 | \setcounter{tocdepth}{0} 69 | 70 | %% 71 | % If there is a `tufte-book-local.sty' file, load it. 72 | 73 | \IfFileExists{tufte-book-local.tex} 74 | {\input{tufte-book-local} 75 | \TufteInfoNL{Loading tufte-book-local.tex}} 76 | {} 77 | 78 | %% 79 | % End of file 80 | \endinput 81 | -------------------------------------------------------------------------------- /2019/2019-1/1-0-latex/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-1/1-0-latex/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-1/1-1-why/1-1-why.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-1-why/1-1-why.pdf -------------------------------------------------------------------------------- /2019/2019-1/1-1-why/1-1-why.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-1-why/1-1-why.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-1/1-1-why/figs/recursion-book-cover.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-1-why/figs/recursion-book-cover.jpg -------------------------------------------------------------------------------- /2019/2019-1/1-1-why/figs/recursion-mirror.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-1-why/figs/recursion-mirror.jpg -------------------------------------------------------------------------------- /2019/2019-1/1-1-why/figs/scale.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-1-why/figs/scale.jpeg -------------------------------------------------------------------------------- /2019/2019-1/1-1-why/figs/try.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-1-why/figs/try.jpg -------------------------------------------------------------------------------- /2019/2019-1/1-1-why/tufte-book.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-book}[2009/12/11 v3.5.0 Tufte-book class] 4 | 5 | %% 6 | % Declare we're tufte-book 7 | \newcommand{\@tufte@class}{book}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-book}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any book-specific stuff now 17 | 18 | %% 19 | % The front matter in Tufte's /Beautiful Evidence/ contains everything up 20 | % to the opening page of Chapter 1. The running heads, when they appear, 21 | % contain only the (arabic) page number in the outside corner. 22 | %\newif\if@mainmatter \@mainmattertrue 23 | \renewcommand\frontmatter{% 24 | \cleardoublepage% 25 | \@mainmatterfalse% 26 | \pagenumbering{arabic}% 27 | %\pagestyle{plain}% 28 | \fancyhf{}% 29 | \ifthenelse{\boolean{@tufte@twoside}}% 30 | {\fancyhead[LE,RO]{\thepage}}% 31 | {\fancyhead[RE,RO]{\thepage}}% 32 | } 33 | 34 | 35 | %% 36 | % The main matter in Tufte's /Beautiful Evidence/ doesn't restart the page 37 | % numbering---it continues where it left off in the front matter. 38 | \renewcommand\mainmatter{% 39 | \cleardoublepage% 40 | \@mainmattertrue% 41 | \fancyhf{}% 42 | \ifthenelse{\boolean{@tufte@twoside}}% 43 | {% two-side 44 | \renewcommand{\chaptermark}[1]{\markboth{##1}{}}% 45 | \fancyhead[LE]{\thepage\quad\smallcaps{\newlinetospace{\plaintitle}}}% book title 46 | \fancyhead[RO]{\smallcaps{\newlinetospace{\leftmark}}\quad\thepage}% chapter title 47 | }% 48 | {% one-side 49 | \fancyhead[RE,RO]{\smallcaps{\newlinetospace{\plaintitle}}\quad\thepage}% book title 50 | }% 51 | } 52 | 53 | 54 | %% 55 | % The back matter contains appendices, indices, glossaries, endnotes, 56 | % biliographies, list of contributors, illustration credits, etc. 57 | \renewcommand\backmatter{% 58 | \if@openright% 59 | \cleardoublepage% 60 | \else% 61 | \clearpage% 62 | \fi% 63 | \@mainmatterfalse% 64 | } 65 | 66 | %% 67 | % Only show the chapter titles in the table of contents 68 | \setcounter{tocdepth}{0} 69 | 70 | %% 71 | % If there is a `tufte-book-local.sty' file, load it. 72 | 73 | \IfFileExists{tufte-book-local.tex} 74 | {\input{tufte-book-local} 75 | \TufteInfoNL{Loading tufte-book-local.tex}} 76 | {} 77 | 78 | %% 79 | % End of file 80 | \endinput 81 | -------------------------------------------------------------------------------- /2019/2019-1/1-1-why/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-1/1-1-why/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-1/1-10-function/1-10-function.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-10-function/1-10-function.pdf -------------------------------------------------------------------------------- /2019/2019-1/1-10-function/1-10-function.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-10-function/1-10-function.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-1/1-10-function/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | ## Homework 4 | 5 | ### OLD 6 | - UD 第14章问题 3、5、6、21、23 7 | - UD 第15章问题 10、14、15、17 8 | - UD 第16章问题 6、7、14、15、16、17、18 9 | - UD 第17章问题 21、22、23、24 10 | 11 | ### NEW 12 | - UD 第14章问题 3 (b, d, g)、5、23 13 | - UD 第15章问题 10 (f, g, h)、14、15 14 | - UD 第16章问题 6、14、17、22 15 | - UD 第17章问题 22、23 16 | 17 | - 选做题: 18 | - 3.30 of "Elements of Set Theory" 19 | 20 | ## OT 21 | 22 | ### OLD 23 | - bijection 24 | 25 | ### NEW 26 | - Lambda Calculus 27 | - Recursive Functions 28 | -------------------------------------------------------------------------------- /2019/2019-1/1-10-function/figs/AlligatorEggs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-10-function/figs/AlligatorEggs.png -------------------------------------------------------------------------------- /2019/2019-1/1-10-function/figs/mit-lambda.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-10-function/figs/mit-lambda.png -------------------------------------------------------------------------------- /2019/2019-1/1-10-function/figs/scheme-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-10-function/figs/scheme-logo.jpg -------------------------------------------------------------------------------- /2019/2019-1/1-10-function/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-1/1-10-function/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-1/1-11-infinity/1-11-infinity.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-11-infinity/1-11-infinity.pdf -------------------------------------------------------------------------------- /2019/2019-1/1-11-infinity/1-11-infinity.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-11-infinity/1-11-infinity.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-1/1-11-infinity/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | ## Homework 4 | 5 | ### OLD 6 | - UD 第21章问题 4、6、8、9、10、21 7 | - UD 第22章问题 8、10、11、12、18、19、20、21 8 | - UD 第23章问题 1、2、3、4、9、12、13 9 | 10 | ### NEW 11 | - UD 第21章问题 6、10 12 | - UD 第22章问题 10、11、18、21 13 | - UD 第23章问题 1、3 (a, d)、4、9、12 14 | - UD 第24章问题 16 15 | 16 | - 选做题: 17 | - UD 第24章问题 15 18 | 19 | ## OT 20 | 21 | ### OLD 22 | - 选择公理 23 | - 连续统假设 24 | 25 | ### NEW 26 | - 基数 27 | - 序数 28 | 29 | ### TODO 30 | - "基数" 难度较大, 可考虑换掉 31 | -------------------------------------------------------------------------------- /2019/2019-1/1-11-infinity/figs/aleph-null.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-11-infinity/figs/aleph-null.png -------------------------------------------------------------------------------- /2019/2019-1/1-11-infinity/figs/cantor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-11-infinity/figs/cantor.jpg -------------------------------------------------------------------------------- /2019/2019-1/1-11-infinity/figs/ordinal-number.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-11-infinity/figs/ordinal-number.png -------------------------------------------------------------------------------- /2019/2019-1/1-11-infinity/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-1/1-11-infinity/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-1/1-12-partial-lattice/1-12-partial-lattice.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-12-partial-lattice/1-12-partial-lattice.pdf -------------------------------------------------------------------------------- /2019/2019-1/1-12-partial-lattice/1-12-partial-lattice.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-12-partial-lattice/1-12-partial-lattice.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-1/1-12-partial-lattice/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | ## Homework 4 | 5 | ### OLD 6 | - SM 第14章 32、44、46、58、62 (修改为only one isomorphic mapping)、66、70、75 7 | 8 | ### NEW 9 | - SM 第14章 44、58、62 (修改为 only one isomorphic mapping)、71、72、75 10 | 11 | - 选做题: 12 | - 2017级问题求解(一)期末试卷 题目 5 13 | 14 | ## OT 15 | 16 | ### OLD 17 | - 序数 18 | - 分配格充要条件 19 | 20 | ### NEW 21 | - Dilworth's Theorem 22 | - Lattice of Stable Matchings 23 | -------------------------------------------------------------------------------- /2019/2019-1/1-12-partial-lattice/figs/creativity-angles.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-12-partial-lattice/figs/creativity-angles.jpeg -------------------------------------------------------------------------------- /2019/2019-1/1-12-partial-lattice/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-1/1-12-partial-lattice/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-1/1-13-boolean-algebra/1-13-boolean-algebra.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-13-boolean-algebra/1-13-boolean-algebra.pdf -------------------------------------------------------------------------------- /2019/2019-1/1-13-boolean-algebra/1-13-boolean-algebra.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-13-boolean-algebra/1-13-boolean-algebra.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-1/1-13-boolean-algebra/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | ## Homework 4 | 5 | ### OLD 6 | - 证明布尔代数是有界有补分配格,有界有补分配格是布尔代数 7 | - 证明SM定理15.6 8 | - 证明等势(有穷)的布尔代数均同构 9 | 10 | ### NEW 11 | 12 | - 选做题: 13 | - 幂集布尔代数 14 | 15 | ## OT 16 | 17 | ### OLD 18 | - 卡诺图 19 | 20 | ### NEW 21 | -------------------------------------------------------------------------------- /2019/2019-1/1-13-boolean-algebra/figs/George-Boole.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-13-boolean-algebra/figs/George-Boole.jpg -------------------------------------------------------------------------------- /2019/2019-1/1-13-boolean-algebra/figs/digital.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-13-boolean-algebra/figs/digital.jpeg -------------------------------------------------------------------------------- /2019/2019-1/1-13-boolean-algebra/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-1/1-13-boolean-algebra/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-1/1-2-reasoning/1-2-reasoning.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-2-reasoning/1-2-reasoning.pdf -------------------------------------------------------------------------------- /2019/2019-1/1-2-reasoning/1-2-reasoning.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-2-reasoning/1-2-reasoning.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-1/1-2-reasoning/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | ## OLD 4 | - UD第2章问题 1、5、7、11、12、15、16 5 | - UD第3章问题 3、10、11、12、13、14、15 6 | - UD第4章问题 1、5、9、11、20 7 | 8 | # NEW 9 | - UD第2章问题 5、7(a, c, f)、16、(18 deleted) 10 | - UD第3章问题 3(d)、10、12 11 | - UD第4章问题 1、5(j, k)、9、20 12 | 13 | - 选做题: 14 | - Hilbert 式推理系统 15 | - OT: 16 | - 一阶谓词逻辑的自然推理系统 17 | - 前束范式 18 | - SAT Solvers/SMT for Logic (留待以后) 19 | 20 | ## TODO 21 | - 去掉 UD 4.20 22 | -------------------------------------------------------------------------------- /2019/2019-1/1-2-reasoning/figs/Descartes.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-2-reasoning/figs/Descartes.jpeg -------------------------------------------------------------------------------- /2019/2019-1/1-2-reasoning/figs/Gentzen.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-2-reasoning/figs/Gentzen.jpg -------------------------------------------------------------------------------- /2019/2019-1/1-2-reasoning/figs/Hilbert.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-2-reasoning/figs/Hilbert.jpeg -------------------------------------------------------------------------------- /2019/2019-1/1-2-reasoning/figs/logic-imagination.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-2-reasoning/figs/logic-imagination.jpg -------------------------------------------------------------------------------- /2019/2019-1/1-2-reasoning/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-1/1-2-reasoning/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-1/1-3-proof/1-3-proof.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-3-proof/1-3-proof.pdf -------------------------------------------------------------------------------- /2019/2019-1/1-3-proof/1-3-proof.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-3-proof/1-3-proof.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-1/1-3-proof/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | ## OLD 4 | - UD第5章问题 21、24 5 | - UD第18章问题 11、15、20、22、24、25 6 | - ES第24节练习 4、6、8 7 | 8 | # NEW 9 | - UD第5章问题 12、24 10 | - UD第18章问题 20、26; +prime problem 11 | - ES第24节练习 4、6、7 12 | 13 | - 选做题: 14 | - Numbers 15 | 16 | - OT: 17 | - `Induction.v` in Coq 18 | - Double Counting 19 | 20 | # Suggestions 21 | - 去掉 UD 5.24 (Squaring) 22 | -------------------------------------------------------------------------------- /2019/2019-1/1-3-proof/figs/bent-line-zn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-3-proof/figs/bent-line-zn.png -------------------------------------------------------------------------------- /2019/2019-1/1-3-proof/figs/domino.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-3-proof/figs/domino.jpg -------------------------------------------------------------------------------- /2019/2019-1/1-3-proof/figs/dominoeffect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-3-proof/figs/dominoeffect.png -------------------------------------------------------------------------------- /2019/2019-1/1-3-proof/figs/good-will-hunting-counting-trees.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-3-proof/figs/good-will-hunting-counting-trees.jpeg -------------------------------------------------------------------------------- /2019/2019-1/1-3-proof/figs/pigeon-hole-principle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-3-proof/figs/pigeon-hole-principle.png -------------------------------------------------------------------------------- /2019/2019-1/1-3-proof/figs/straight-line-ln.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-3-proof/figs/straight-line-ln.png -------------------------------------------------------------------------------- /2019/2019-1/1-3-proof/figs/zigzag-zzn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-3-proof/figs/zigzag-zzn.png -------------------------------------------------------------------------------- /2019/2019-1/1-3-proof/tufte-book.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-book}[2009/12/11 v3.5.0 Tufte-book class] 4 | 5 | %% 6 | % Declare we're tufte-book 7 | \newcommand{\@tufte@class}{book}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-book}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any book-specific stuff now 17 | 18 | %% 19 | % The front matter in Tufte's /Beautiful Evidence/ contains everything up 20 | % to the opening page of Chapter 1. The running heads, when they appear, 21 | % contain only the (arabic) page number in the outside corner. 22 | %\newif\if@mainmatter \@mainmattertrue 23 | \renewcommand\frontmatter{% 24 | \cleardoublepage% 25 | \@mainmatterfalse% 26 | \pagenumbering{arabic}% 27 | %\pagestyle{plain}% 28 | \fancyhf{}% 29 | \ifthenelse{\boolean{@tufte@twoside}}% 30 | {\fancyhead[LE,RO]{\thepage}}% 31 | {\fancyhead[RE,RO]{\thepage}}% 32 | } 33 | 34 | 35 | %% 36 | % The main matter in Tufte's /Beautiful Evidence/ doesn't restart the page 37 | % numbering---it continues where it left off in the front matter. 38 | \renewcommand\mainmatter{% 39 | \cleardoublepage% 40 | \@mainmattertrue% 41 | \fancyhf{}% 42 | \ifthenelse{\boolean{@tufte@twoside}}% 43 | {% two-side 44 | \renewcommand{\chaptermark}[1]{\markboth{##1}{}}% 45 | \fancyhead[LE]{\thepage\quad\smallcaps{\newlinetospace{\plaintitle}}}% book title 46 | \fancyhead[RO]{\smallcaps{\newlinetospace{\leftmark}}\quad\thepage}% chapter title 47 | }% 48 | {% one-side 49 | \fancyhead[RE,RO]{\smallcaps{\newlinetospace{\plaintitle}}\quad\thepage}% book title 50 | }% 51 | } 52 | 53 | 54 | %% 55 | % The back matter contains appendices, indices, glossaries, endnotes, 56 | % biliographies, list of contributors, illustration credits, etc. 57 | \renewcommand\backmatter{% 58 | \if@openright% 59 | \cleardoublepage% 60 | \else% 61 | \clearpage% 62 | \fi% 63 | \@mainmatterfalse% 64 | } 65 | 66 | %% 67 | % Only show the chapter titles in the table of contents 68 | \setcounter{tocdepth}{0} 69 | 70 | %% 71 | % If there is a `tufte-book-local.sty' file, load it. 72 | 73 | \IfFileExists{tufte-book-local.tex} 74 | {\input{tufte-book-local} 75 | \TufteInfoNL{Loading tufte-book-local.tex}} 76 | {} 77 | 78 | %% 79 | % End of file 80 | \endinput 81 | -------------------------------------------------------------------------------- /2019/2019-1/1-3-proof/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-1/1-3-proof/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-1/1-4-algorithm/1-4-algorithm.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-4-algorithm/1-4-algorithm.pdf -------------------------------------------------------------------------------- /2019/2019-1/1-4-algorithm/1-4-algorithm.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-4-algorithm/1-4-algorithm.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-1/1-4-algorithm/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | ## OLD 4 | - DH第2章练习 1、2、3、4、5、6、7、8 5 | 6 | # NEW 7 | - DH第2章练习 2、4、5、7、8 8 | 9 | - 选做题: 10 | - 无? 11 | 12 | - OT: 13 | - 尾递归 14 | - 结构化程序设计 15 | 16 | # Suggestion 17 | - [ ] Call Stack (修改后作为第一个 OT) 18 | - 参考: 《深入理解计算机系统》 19 | - [ ] 去掉 DH 2.4 (Sum&Product) 20 | -------------------------------------------------------------------------------- /2019/2019-1/1-4-algorithm/figs/algorithm-dict.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-4-algorithm/figs/algorithm-dict.jpg -------------------------------------------------------------------------------- /2019/2019-1/1-4-algorithm/figs/difficult.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-4-algorithm/figs/difficult.jpg -------------------------------------------------------------------------------- /2019/2019-1/1-4-algorithm/figs/knuth-algorithm-believed.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-4-algorithm/figs/knuth-algorithm-believed.jpeg -------------------------------------------------------------------------------- /2019/2019-1/1-4-algorithm/figs/knuth-beauty.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-4-algorithm/figs/knuth-beauty.jpeg -------------------------------------------------------------------------------- /2019/2019-1/1-4-algorithm/figs/knuth-programming-art.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-4-algorithm/figs/knuth-programming-art.jpg -------------------------------------------------------------------------------- /2019/2019-1/1-4-algorithm/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-1/1-4-algorithm/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-1/1-5-data-structure/1-5-data-structure.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-5-data-structure/1-5-data-structure.pdf -------------------------------------------------------------------------------- /2019/2019-1/1-5-data-structure/1-5-data-structure.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-5-data-structure/1-5-data-structure.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-1/1-5-data-structure/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | ## OLD 4 | - DH第2章练习 10、11、12、13、14、15、16 5 | 6 | # NEW 7 | - DH第2章练习 11、12 (a: III; b; c)、13、14 (b; c)、16 8 | 9 | - 选做题: 10 | - Stackable Permutations of An 11 | 12 | - OT: 13 | - Pointers and Arrays 14 | - Sequential Containers in C++ STL 15 | -------------------------------------------------------------------------------- /2019/2019-1/1-5-data-structure/figs/boring-teachers.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-5-data-structure/figs/boring-teachers.jpg -------------------------------------------------------------------------------- /2019/2019-1/1-5-data-structure/figs/data-structure-first.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-5-data-structure/figs/data-structure-first.jpg -------------------------------------------------------------------------------- /2019/2019-1/1-5-data-structure/figs/data-structure-linus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-5-data-structure/figs/data-structure-linus.png -------------------------------------------------------------------------------- /2019/2019-1/1-5-data-structure/figs/smart-data-structures.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-5-data-structure/figs/smart-data-structures.jpg -------------------------------------------------------------------------------- /2019/2019-1/1-5-data-structure/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-1/1-5-data-structure/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-1/1-6-programming-language/1-6-programming-language.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-6-programming-language/1-6-programming-language.pdf -------------------------------------------------------------------------------- /2019/2019-1/1-6-programming-language/1-6-programming-language.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-6-programming-language/1-6-programming-language.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-1/1-6-programming-language/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | ## Homework 4 | 5 | ### OLD 6 | - C++ 语言算术表达式的文法 7 | 8 | ### NEW 9 | - [x] IMP 类 C 语言的文法 10 | 11 | - 选做题: 12 | - [x] Write the "P-with-parameter-V" program (P54) 13 | 14 | ## OT 15 | 16 | ### OLD 17 | - 介绍"正则表达式"与"自动状态机", 谈谈对"语言"的理解 18 | - 写出某个 C++ 版本中 Switch 语言的 BNF 19 | 20 | ### NEW 21 | - [x] 介绍"正则表达式"的语法、语义与用例 22 | - [x] 介绍 "An Axiomatic Basis for Computer Programming" by Hoare 23 | -------------------------------------------------------------------------------- /2019/2019-1/1-6-programming-language/figs/hoare.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-6-programming-language/figs/hoare.jpeg -------------------------------------------------------------------------------- /2019/2019-1/1-6-programming-language/figs/syntax-semantics.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-6-programming-language/figs/syntax-semantics.jpeg -------------------------------------------------------------------------------- /2019/2019-1/1-6-programming-language/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-1/1-6-programming-language/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-1/1-7-programming-paradigm/1-7-programming-paradigm.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-7-programming-paradigm/1-7-programming-paradigm.pdf -------------------------------------------------------------------------------- /2019/2019-1/1-7-programming-paradigm/1-7-programming-paradigm.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-7-programming-paradigm/1-7-programming-paradigm.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-1/1-7-programming-paradigm/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | ## 必做题 4 | 5 | ### OLD 6 | - 在网上查一下,什么是 scripting language,它们和 C++ 这样的程序设计语言有什么不同? 7 | - 用 Prolog 语言编写 Tower of Hanoi 问题求解程序。 8 | - 某个企业的员工工资信息采用如下list形式存放。请你写出求该企业月工资发放总额的函数式程序。 9 | - 表名: Employee_Salary 10 | - 表结构: (employee_ID salary) 11 | - 样例: ((20160226001 21000) (20160226002 19800) ...) 12 | 13 | 可能用到的表操纵基本函数: first, rest 14 | 15 | ### NEW 16 | - 完成 Coq "Lists.v" 17 | 18 | ## 选做题 19 | - 完成 Coq "FP.v" 20 | 21 | ## OT 22 | 23 | ### OLD 24 | - 介绍图灵机 25 | - Java 语言的 "网络安全性" 26 | 27 | ### NEW 28 | - Coq "FP.v": High-order Functions 29 | - Coq "FP.v": Church Numerals 30 | -------------------------------------------------------------------------------- /2019/2019-1/1-7-programming-paradigm/figs/haskell-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-7-programming-paradigm/figs/haskell-logo.png -------------------------------------------------------------------------------- /2019/2019-1/1-7-programming-paradigm/figs/haskell-quicksort.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-7-programming-paradigm/figs/haskell-quicksort.jpg -------------------------------------------------------------------------------- /2019/2019-1/1-7-programming-paradigm/figs/haskell-side-effects.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-7-programming-paradigm/figs/haskell-side-effects.jpeg -------------------------------------------------------------------------------- /2019/2019-1/1-7-programming-paradigm/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-1/1-7-programming-paradigm/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-1/1-8-set/1-8-set.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-8-set/1-8-set.pdf -------------------------------------------------------------------------------- /2019/2019-1/1-8-set/1-8-set.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-8-set/1-8-set.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-1/1-8-set/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | ## Homework 4 | 5 | ### OLD 6 | - UD 第6章问题 6、19、22 7 | - UD 第7章问题 1、12、14、17、18 8 | - UD 第8章问题 1、6、13、14、15、18 9 | - UD 第9章问题 5、8、17、18、19、23 10 | 11 | ### NEW 12 | - UD 第6章问题 9 (d,e; 行优先字母序) 13 | - UD 第7章问题 1 (d, f)、2、14、19、20 14 | - UD 第8章问题 1 (a, b)、14、15 15 | - UD 第9章问题 8、9、10、19 (adapted: B\C) 16 | 17 | - 选做题: 18 | - UD 9.23 19 | 20 | ## OT 21 | 22 | ### OLD 23 | - 集合与自然数 24 | - 悖论 25 | 26 | ### NEW 27 | - 集合与自然数 28 | - 选择公理 29 | -------------------------------------------------------------------------------- /2019/2019-1/1-8-set/figs/frege.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-8-set/figs/frege.jpg -------------------------------------------------------------------------------- /2019/2019-1/1-8-set/tufte-book.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-book}[2009/12/11 v3.5.0 Tufte-book class] 4 | 5 | %% 6 | % Declare we're tufte-book 7 | \newcommand{\@tufte@class}{book}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-book}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any book-specific stuff now 17 | 18 | %% 19 | % The front matter in Tufte's /Beautiful Evidence/ contains everything up 20 | % to the opening page of Chapter 1. The running heads, when they appear, 21 | % contain only the (arabic) page number in the outside corner. 22 | %\newif\if@mainmatter \@mainmattertrue 23 | \renewcommand\frontmatter{% 24 | \cleardoublepage% 25 | \@mainmatterfalse% 26 | \pagenumbering{arabic}% 27 | %\pagestyle{plain}% 28 | \fancyhf{}% 29 | \ifthenelse{\boolean{@tufte@twoside}}% 30 | {\fancyhead[LE,RO]{\thepage}}% 31 | {\fancyhead[RE,RO]{\thepage}}% 32 | } 33 | 34 | 35 | %% 36 | % The main matter in Tufte's /Beautiful Evidence/ doesn't restart the page 37 | % numbering---it continues where it left off in the front matter. 38 | \renewcommand\mainmatter{% 39 | \cleardoublepage% 40 | \@mainmattertrue% 41 | \fancyhf{}% 42 | \ifthenelse{\boolean{@tufte@twoside}}% 43 | {% two-side 44 | \renewcommand{\chaptermark}[1]{\markboth{##1}{}}% 45 | \fancyhead[LE]{\thepage\quad\smallcaps{\newlinetospace{\plaintitle}}}% book title 46 | \fancyhead[RO]{\smallcaps{\newlinetospace{\leftmark}}\quad\thepage}% chapter title 47 | }% 48 | {% one-side 49 | \fancyhead[RE,RO]{\smallcaps{\newlinetospace{\plaintitle}}\quad\thepage}% book title 50 | }% 51 | } 52 | 53 | 54 | %% 55 | % The back matter contains appendices, indices, glossaries, endnotes, 56 | % biliographies, list of contributors, illustration credits, etc. 57 | \renewcommand\backmatter{% 58 | \if@openright% 59 | \cleardoublepage% 60 | \else% 61 | \clearpage% 62 | \fi% 63 | \@mainmatterfalse% 64 | } 65 | 66 | %% 67 | % Only show the chapter titles in the table of contents 68 | \setcounter{tocdepth}{0} 69 | 70 | %% 71 | % If there is a `tufte-book-local.sty' file, load it. 72 | 73 | \IfFileExists{tufte-book-local.tex} 74 | {\input{tufte-book-local} 75 | \TufteInfoNL{Loading tufte-book-local.tex}} 76 | {} 77 | 78 | %% 79 | % End of file 80 | \endinput 81 | -------------------------------------------------------------------------------- /2019/2019-1/1-8-set/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-1/1-8-set/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-1/1-9-relation/1-9-relation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-9-relation/1-9-relation.pdf -------------------------------------------------------------------------------- /2019/2019-1/1-9-relation/1-9-relation.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-9-relation/1-9-relation.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-1/1-9-relation/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | ## Homework 4 | 5 | ### OLD 6 | - UD 第10章问题 7、9、10、13 7 | - UD 第11章问题 4、8、9、10 8 | - UD 第12章问题 11 9 | - UD 第13章问题 11、12、13、18 10 | 11 | ### NEW 12 | - UD 第10章问题 9、10、13 13 | - UD 第11章问题 4、8、10 14 | - UD 第12章问题 11 (a, b)、12 15 | - UD 第13章问题 14 16 | 17 | - 选做题: 18 | - 关系的复合 19 | 20 | ## OT 21 | 22 | ### OLD 23 | - 关系 24 | - 实数 25 | 26 | ### NEW 27 | - 关系 28 | - 实数 29 | 30 | ## TODO 31 | - 换 OT 题目 32 | -------------------------------------------------------------------------------- /2019/2019-1/1-9-relation/figs/wulin-relation.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-1/1-9-relation/figs/wulin-relation.jpeg -------------------------------------------------------------------------------- /2019/2019-1/1-9-relation/tufte-book.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-book}[2009/12/11 v3.5.0 Tufte-book class] 4 | 5 | %% 6 | % Declare we're tufte-book 7 | \newcommand{\@tufte@class}{book}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-book}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any book-specific stuff now 17 | 18 | %% 19 | % The front matter in Tufte's /Beautiful Evidence/ contains everything up 20 | % to the opening page of Chapter 1. The running heads, when they appear, 21 | % contain only the (arabic) page number in the outside corner. 22 | %\newif\if@mainmatter \@mainmattertrue 23 | \renewcommand\frontmatter{% 24 | \cleardoublepage% 25 | \@mainmatterfalse% 26 | \pagenumbering{arabic}% 27 | %\pagestyle{plain}% 28 | \fancyhf{}% 29 | \ifthenelse{\boolean{@tufte@twoside}}% 30 | {\fancyhead[LE,RO]{\thepage}}% 31 | {\fancyhead[RE,RO]{\thepage}}% 32 | } 33 | 34 | 35 | %% 36 | % The main matter in Tufte's /Beautiful Evidence/ doesn't restart the page 37 | % numbering---it continues where it left off in the front matter. 38 | \renewcommand\mainmatter{% 39 | \cleardoublepage% 40 | \@mainmattertrue% 41 | \fancyhf{}% 42 | \ifthenelse{\boolean{@tufte@twoside}}% 43 | {% two-side 44 | \renewcommand{\chaptermark}[1]{\markboth{##1}{}}% 45 | \fancyhead[LE]{\thepage\quad\smallcaps{\newlinetospace{\plaintitle}}}% book title 46 | \fancyhead[RO]{\smallcaps{\newlinetospace{\leftmark}}\quad\thepage}% chapter title 47 | }% 48 | {% one-side 49 | \fancyhead[RE,RO]{\smallcaps{\newlinetospace{\plaintitle}}\quad\thepage}% book title 50 | }% 51 | } 52 | 53 | 54 | %% 55 | % The back matter contains appendices, indices, glossaries, endnotes, 56 | % biliographies, list of contributors, illustration credits, etc. 57 | \renewcommand\backmatter{% 58 | \if@openright% 59 | \cleardoublepage% 60 | \else% 61 | \clearpage% 62 | \fi% 63 | \@mainmatterfalse% 64 | } 65 | 66 | %% 67 | % Only show the chapter titles in the table of contents 68 | \setcounter{tocdepth}{0} 69 | 70 | %% 71 | % If there is a `tufte-book-local.sty' file, load it. 72 | 73 | \IfFileExists{tufte-book-local.tex} 74 | {\input{tufte-book-local} 75 | \TufteInfoNL{Loading tufte-book-local.tex}} 76 | {} 77 | 78 | %% 79 | % End of file 80 | \endinput 81 | -------------------------------------------------------------------------------- /2019/2019-1/1-9-relation/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-1/1-9-relation/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-1/Makefile: -------------------------------------------------------------------------------- 1 | # Extract problems from pdf 2 | 3 | # Usage: make DIR=1-4-algorithm 4 | # make DIR=1-5-data-structure 5 | # make 6 | 7 | DIR ?= [0-9]* 8 | SRC ?= $(DIR)/*.pdf 9 | TXT = $(SRC:.pdf=.txt) 10 | 11 | all: 12 | @for i in $(SRC); do pdftotext $$i; done 13 | @for i in $(TXT); do echo $$(dirname $$i); grep 题目 $$i | nl -n ln | sed -e '/.*题目 [0-9]\+ ([0-9]\+-[0-9]\+-[0-9]\+)/d' -e 's/\([0-9]\+\).*题目 \([0-9]\+\) /\1 \2:/g' -e 's/\([0-9]\+\).*题目 /第\1题:/g' -e 's/:(/:/g' -e 's/)$$//g' -e 's/^\([0-9]\+\) \1/第\1题/g' -e 's/^[0-9]\+ \([0-9]\+\)/选做\1/g'; echo; done 14 | @rm -f $(TXT) 15 | -------------------------------------------------------------------------------- /2019/2019-1/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | - 确定习题 4 | - 参与人员: 魏恒峰、裴一凡、黄秉焜 5 | - 截止日期: 每周日晚上 22:00 6 | - 确定OT 7 | - 截止日期: 每周日晚上 22:00 8 | - 发布作业 9 | - 参与人员: 唐瑞泽 10 | - 发布日期: 每周二中午 12:00 之后 11 | - 截止时间: 下周一晚上 22:00 12 | - 打包上传到课程网站、开通作业提交系统、发布群公告 13 | - 提醒时间: 下周一晚上 20:00 之前 14 | - 发布问卷 15 | - 参与人员: 唐瑞泽 16 | - 发布时间: 每周一上午 17 | - 截止时间: 每周二中午 12:00 18 | - 提醒时间: 每周二中午 11:00 19 | -------------------------------------------------------------------------------- /2019/2019-2/2-1-correctness/2-1-correctness.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-1-correctness/2-1-correctness.pdf -------------------------------------------------------------------------------- /2019/2019-2/2-1-correctness/2-1-correctness.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-1-correctness/2-1-correctness.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-2/2-1-correctness/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | ## Homework 4 | 5 | ### OLD 6 | - DH 第5章练习 6, 9, 10, 12 7 | - 证明 Euclid (欧几里德) 算法的部分正确性 8 | 9 | ### NEW 10 | - DH 第5章练习 8, 9, 10, 12, 14 11 | - 证明 Euclid (欧几里德) 算法的部分正确性 12 | 13 | ## OT 14 | 15 | ### OLD 16 | - Insertion Sort 的正确性 17 | - Cyclic Hanoi Problem 算法的正确性证明 18 | 19 | ### NEW 20 | - Insertion Sort 的正确性 (推荐使用 Dafny) 21 | - Cyclic Hanoi Problem 算法的正确性证明 22 | -------------------------------------------------------------------------------- /2019/2019-2/2-1-correctness/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-2/2-1-correctness/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-2/2-10-data-structures/2-10-data-structures.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-10-data-structures/2-10-data-structures.pdf -------------------------------------------------------------------------------- /2019/2019-2/2-10-data-structures/2-10-data-structures.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-10-data-structures/2-10-data-structures.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-2/2-10-data-structures/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | ## Homework 4 | 5 | ### OLD 6 | - MA 2.6 (只要求考察 Push 操作) 7 | - TC 第 10.1 节练习 4、5、6 8 | - TC 第 10.2 节练习 1、2、3、6 9 | - TC 第 10.3 节练习 4、5 10 | - TC 第 10.4 节练习 2、3、4 11 | - TC 第 10 章问题 3 12 | 13 | ### NEW 14 | - MA 2.6 (只要求考察 Push 操作) 15 | - TC 第 10.1 节练习 4、6 16 | - TC 第 10.2 节练习 6 17 | - TC 第 10.3 节练习 4、5 18 | - TC 第 10.4 节练习 2、3 19 | - TC 第 10 章问题 3 20 | 21 | ### Additional 22 | - TC 第 10.1 节练习 7 23 | 24 | ## OT 25 | 26 | ### OLD 27 | - A Stack, Two Queues 28 | - Stack 实现的正确性 29 | 30 | ### NEW 31 | - Stack 与 Queue 之间的互模拟 (TC 10.1-6, TC 10.1-7) 32 | - TC Problem 10-3 (Searching a sorted compact list) -------------------------------------------------------------------------------- /2019/2019-2/2-10-data-structures/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-2/2-10-data-structures/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-2/2-11-heapsort/2-11-heapsort.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-11-heapsort/2-11-heapsort.pdf -------------------------------------------------------------------------------- /2019/2019-2/2-11-heapsort/2-11-heapsort.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-11-heapsort/2-11-heapsort.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-2/2-11-heapsort/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | ## Homework 4 | 5 | ### OLD 6 | - TC 第 6.1 节练习 2、4、7 7 | - TC 第 6.2 节练习 2、5、6 8 | - TC 第 6.3 节练习 3 9 | - TC 第 6.4 节练习 2、4 10 | - TC 第 6.5 节练习 5、7、9 11 | 12 | ### NEW 13 | - TC 6.1-2、6.1-7 14 | - TC 6.2-5、6.2-6 15 | - TC 6.3-3 16 | - TC 6.4-2、6.4-4、6.4-5 17 | - TC 6.5-5、6.5-9 18 | 19 | ### Additional 20 | - Heap Equality 21 | 22 | ## OT 23 | 24 | ### OLD 25 | - Heapsort vs. Quicksort 性能 26 | - Binary tree => Heap => Priority queue 27 | 28 | ### NEW 29 | - Binomial Heaps 30 | - Fibonacci Heaps -------------------------------------------------------------------------------- /2019/2019-2/2-11-heapsort/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-2/2-11-heapsort/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-2/2-12-hashing/2-12-hashing.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-12-hashing/2-12-hashing.pdf -------------------------------------------------------------------------------- /2019/2019-2/2-12-hashing/2-12-hashing.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-12-hashing/2-12-hashing.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-2/2-12-hashing/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | ## Homework 4 | 5 | ### OLD 6 | - CS 第 5.5 节问题 8、14 7 | - TC 第 11.2 节练习 3、6 8 | - TC 第 11.3 节练习 3、4 9 | - TC 第 11.4 节练习 2、3 10 | - TC 第 11 章问题 1、2 11 | 12 | ### NEW 13 | - CS 5.5-8 (a, b, c) 14 | - TC 11.2-3 15 | - TC 11.3-3 16 | - TC 11.4-3 17 | - TC Problem 11-1、Problem 11-2 18 | 19 | ### Additional 20 | - TC 11.2-6 21 | 22 | ## OT 23 | 24 | ### OLD 25 | - Universal Hashing 26 | - Hashing 故事 27 | 28 | ### NEW 29 | - Perfect Hashing 30 | - Bloom filter -------------------------------------------------------------------------------- /2019/2019-2/2-12-hashing/tufte-book.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-book}[2009/12/11 v3.5.0 Tufte-book class] 4 | 5 | %% 6 | % Declare we're tufte-book 7 | \newcommand{\@tufte@class}{book}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-book}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any book-specific stuff now 17 | 18 | %% 19 | % The front matter in Tufte's /Beautiful Evidence/ contains everything up 20 | % to the opening page of Chapter 1. The running heads, when they appear, 21 | % contain only the (arabic) page number in the outside corner. 22 | %\newif\if@mainmatter \@mainmattertrue 23 | \renewcommand\frontmatter{% 24 | \cleardoublepage% 25 | \@mainmatterfalse% 26 | \pagenumbering{arabic}% 27 | %\pagestyle{plain}% 28 | \fancyhf{}% 29 | \ifthenelse{\boolean{@tufte@twoside}}% 30 | {\fancyhead[LE,RO]{\thepage}}% 31 | {\fancyhead[RE,RO]{\thepage}}% 32 | } 33 | 34 | 35 | %% 36 | % The main matter in Tufte's /Beautiful Evidence/ doesn't restart the page 37 | % numbering---it continues where it left off in the front matter. 38 | \renewcommand\mainmatter{% 39 | \cleardoublepage% 40 | \@mainmattertrue% 41 | \fancyhf{}% 42 | \ifthenelse{\boolean{@tufte@twoside}}% 43 | {% two-side 44 | \renewcommand{\chaptermark}[1]{\markboth{##1}{}}% 45 | \fancyhead[LE]{\thepage\quad\smallcaps{\newlinetospace{\plaintitle}}}% book title 46 | \fancyhead[RO]{\smallcaps{\newlinetospace{\leftmark}}\quad\thepage}% chapter title 47 | }% 48 | {% one-side 49 | \fancyhead[RE,RO]{\smallcaps{\newlinetospace{\plaintitle}}\quad\thepage}% book title 50 | }% 51 | } 52 | 53 | 54 | %% 55 | % The back matter contains appendices, indices, glossaries, endnotes, 56 | % biliographies, list of contributors, illustration credits, etc. 57 | \renewcommand\backmatter{% 58 | \if@openright% 59 | \cleardoublepage% 60 | \else% 61 | \clearpage% 62 | \fi% 63 | \@mainmatterfalse% 64 | } 65 | 66 | %% 67 | % Only show the chapter titles in the table of contents 68 | \setcounter{tocdepth}{0} 69 | 70 | %% 71 | % If there is a `tufte-book-local.sty' file, load it. 72 | 73 | \IfFileExists{tufte-book-local.tex} 74 | {\input{tufte-book-local} 75 | \TufteInfoNL{Loading tufte-book-local.tex}} 76 | {} 77 | 78 | %% 79 | % End of file 80 | \endinput 81 | -------------------------------------------------------------------------------- /2019/2019-2/2-12-hashing/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-2/2-12-hashing/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-2/2-13-bst/2-13-bst.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-13-bst/2-13-bst.pdf -------------------------------------------------------------------------------- /2019/2019-2/2-13-bst/2-13-bst.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-13-bst/2-13-bst.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-2/2-13-bst/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | ## Homework 4 | 5 | ### OLD 6 | - TC 第 12.1 节练习 2、5 7 | - TC 第 12.2 节练习 5、9 8 | - TC 第 12.3 节练习 5 9 | 10 | ### NEW 11 | - TC 12.1-5 12 | - TC 12.2-9 13 | - TC 12.3-5 14 | 15 | ### Additional 16 | 17 | ## OT 18 | 19 | ### OLD 20 | - Splay tree 21 | - 中序遍历的正确性 22 | 23 | ### NEW 24 | - Splay tree 25 | (建议: 调整到 Red-Black Tree 章节) -------------------------------------------------------------------------------- /2019/2019-2/2-13-bst/tufte-book.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-book}[2009/12/11 v3.5.0 Tufte-book class] 4 | 5 | %% 6 | % Declare we're tufte-book 7 | \newcommand{\@tufte@class}{book}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-book}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any book-specific stuff now 17 | 18 | %% 19 | % The front matter in Tufte's /Beautiful Evidence/ contains everything up 20 | % to the opening page of Chapter 1. The running heads, when they appear, 21 | % contain only the (arabic) page number in the outside corner. 22 | %\newif\if@mainmatter \@mainmattertrue 23 | \renewcommand\frontmatter{% 24 | \cleardoublepage% 25 | \@mainmatterfalse% 26 | \pagenumbering{arabic}% 27 | %\pagestyle{plain}% 28 | \fancyhf{}% 29 | \ifthenelse{\boolean{@tufte@twoside}}% 30 | {\fancyhead[LE,RO]{\thepage}}% 31 | {\fancyhead[RE,RO]{\thepage}}% 32 | } 33 | 34 | 35 | %% 36 | % The main matter in Tufte's /Beautiful Evidence/ doesn't restart the page 37 | % numbering---it continues where it left off in the front matter. 38 | \renewcommand\mainmatter{% 39 | \cleardoublepage% 40 | \@mainmattertrue% 41 | \fancyhf{}% 42 | \ifthenelse{\boolean{@tufte@twoside}}% 43 | {% two-side 44 | \renewcommand{\chaptermark}[1]{\markboth{##1}{}}% 45 | \fancyhead[LE]{\thepage\quad\smallcaps{\newlinetospace{\plaintitle}}}% book title 46 | \fancyhead[RO]{\smallcaps{\newlinetospace{\leftmark}}\quad\thepage}% chapter title 47 | }% 48 | {% one-side 49 | \fancyhead[RE,RO]{\smallcaps{\newlinetospace{\plaintitle}}\quad\thepage}% book title 50 | }% 51 | } 52 | 53 | 54 | %% 55 | % The back matter contains appendices, indices, glossaries, endnotes, 56 | % biliographies, list of contributors, illustration credits, etc. 57 | \renewcommand\backmatter{% 58 | \if@openright% 59 | \cleardoublepage% 60 | \else% 61 | \clearpage% 62 | \fi% 63 | \@mainmatterfalse% 64 | } 65 | 66 | %% 67 | % Only show the chapter titles in the table of contents 68 | \setcounter{tocdepth}{0} 69 | 70 | %% 71 | % If there is a `tufte-book-local.sty' file, load it. 72 | 73 | \IfFileExists{tufte-book-local.tex} 74 | {\input{tufte-book-local} 75 | \TufteInfoNL{Loading tufte-book-local.tex}} 76 | {} 77 | 78 | %% 79 | % End of file 80 | \endinput 81 | -------------------------------------------------------------------------------- /2019/2019-2/2-13-bst/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-2/2-13-bst/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-2/2-14-b-tree/2-14-b-tree.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-14-b-tree/2-14-b-tree.pdf -------------------------------------------------------------------------------- /2019/2019-2/2-14-b-tree/2-14-b-tree.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-14-b-tree/2-14-b-tree.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-2/2-14-b-tree/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | ## Homework 4 | 5 | ### OLD 6 | - TC 练习 18.1.1, 18.1.4 7 | - TC 练习 18.2.3, 18.2.4 8 | - TC 练习 18.3.1 9 | 10 | ### NEW 11 | - TC 18.1-1, TC 18.1-4 12 | - TC 18.2-3 13 | - TC 18.3-1 14 | 15 | ### Additional 16 | - TC 18.2-4 17 | 18 | ## OT 19 | 20 | ### OLD 21 | - B 树插入算法对高度的影响 22 | - 介绍 B* 树 23 | 24 | ### NEW 25 | - 2-3 tree & 2-3-4 tree 26 | - \red{建议: 这个OT题目过于简单; 需要找新的题目替换。} -------------------------------------------------------------------------------- /2019/2019-2/2-14-b-tree/tufte-book.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-book}[2009/12/11 v3.5.0 Tufte-book class] 4 | 5 | %% 6 | % Declare we're tufte-book 7 | \newcommand{\@tufte@class}{book}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-book}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any book-specific stuff now 17 | 18 | %% 19 | % The front matter in Tufte's /Beautiful Evidence/ contains everything up 20 | % to the opening page of Chapter 1. The running heads, when they appear, 21 | % contain only the (arabic) page number in the outside corner. 22 | %\newif\if@mainmatter \@mainmattertrue 23 | \renewcommand\frontmatter{% 24 | \cleardoublepage% 25 | \@mainmatterfalse% 26 | \pagenumbering{arabic}% 27 | %\pagestyle{plain}% 28 | \fancyhf{}% 29 | \ifthenelse{\boolean{@tufte@twoside}}% 30 | {\fancyhead[LE,RO]{\thepage}}% 31 | {\fancyhead[RE,RO]{\thepage}}% 32 | } 33 | 34 | 35 | %% 36 | % The main matter in Tufte's /Beautiful Evidence/ doesn't restart the page 37 | % numbering---it continues where it left off in the front matter. 38 | \renewcommand\mainmatter{% 39 | \cleardoublepage% 40 | \@mainmattertrue% 41 | \fancyhf{}% 42 | \ifthenelse{\boolean{@tufte@twoside}}% 43 | {% two-side 44 | \renewcommand{\chaptermark}[1]{\markboth{##1}{}}% 45 | \fancyhead[LE]{\thepage\quad\smallcaps{\newlinetospace{\plaintitle}}}% book title 46 | \fancyhead[RO]{\smallcaps{\newlinetospace{\leftmark}}\quad\thepage}% chapter title 47 | }% 48 | {% one-side 49 | \fancyhead[RE,RO]{\smallcaps{\newlinetospace{\plaintitle}}\quad\thepage}% book title 50 | }% 51 | } 52 | 53 | 54 | %% 55 | % The back matter contains appendices, indices, glossaries, endnotes, 56 | % biliographies, list of contributors, illustration credits, etc. 57 | \renewcommand\backmatter{% 58 | \if@openright% 59 | \cleardoublepage% 60 | \else% 61 | \clearpage% 62 | \fi% 63 | \@mainmatterfalse% 64 | } 65 | 66 | %% 67 | % Only show the chapter titles in the table of contents 68 | \setcounter{tocdepth}{0} 69 | 70 | %% 71 | % If there is a `tufte-book-local.sty' file, load it. 72 | 73 | \IfFileExists{tufte-book-local.tex} 74 | {\input{tufte-book-local} 75 | \TufteInfoNL{Loading tufte-book-local.tex}} 76 | {} 77 | 78 | %% 79 | % End of file 80 | \endinput 81 | -------------------------------------------------------------------------------- /2019/2019-2/2-14-b-tree/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-2/2-14-b-tree/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-2/2-15-rb-tree/2-15-rb-tree.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-15-rb-tree/2-15-rb-tree.pdf -------------------------------------------------------------------------------- /2019/2019-2/2-15-rb-tree/2-15-rb-tree.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-15-rb-tree/2-15-rb-tree.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-2/2-15-rb-tree/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | ## Homework 4 | 5 | ### OLD 6 | - TC 第 13.1 节练习 5、7 7 | - TC 第 13.2 节练习 2 8 | - TC 第 13.3 节练习 1、5 9 | - TC 第 13.4 节练习 1、7 10 | 11 | ### NEW 12 | - TC 18.1-5 13 | - TC 13.1-5、13.1-7 14 | - TC 13.3-1、13.3-5 15 | - TC 13.4-1、13.4-7 16 | 17 | ### Additional 18 | - TC Problem 13-3: AVL trees 19 | 20 | ## OT 21 | 22 | ### OLD 23 | 24 | ### NEW -------------------------------------------------------------------------------- /2019/2019-2/2-15-rb-tree/tufte-book.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-book}[2009/12/11 v3.5.0 Tufte-book class] 4 | 5 | %% 6 | % Declare we're tufte-book 7 | \newcommand{\@tufte@class}{book}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-book}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any book-specific stuff now 17 | 18 | %% 19 | % The front matter in Tufte's /Beautiful Evidence/ contains everything up 20 | % to the opening page of Chapter 1. The running heads, when they appear, 21 | % contain only the (arabic) page number in the outside corner. 22 | %\newif\if@mainmatter \@mainmattertrue 23 | \renewcommand\frontmatter{% 24 | \cleardoublepage% 25 | \@mainmatterfalse% 26 | \pagenumbering{arabic}% 27 | %\pagestyle{plain}% 28 | \fancyhf{}% 29 | \ifthenelse{\boolean{@tufte@twoside}}% 30 | {\fancyhead[LE,RO]{\thepage}}% 31 | {\fancyhead[RE,RO]{\thepage}}% 32 | } 33 | 34 | 35 | %% 36 | % The main matter in Tufte's /Beautiful Evidence/ doesn't restart the page 37 | % numbering---it continues where it left off in the front matter. 38 | \renewcommand\mainmatter{% 39 | \cleardoublepage% 40 | \@mainmattertrue% 41 | \fancyhf{}% 42 | \ifthenelse{\boolean{@tufte@twoside}}% 43 | {% two-side 44 | \renewcommand{\chaptermark}[1]{\markboth{##1}{}}% 45 | \fancyhead[LE]{\thepage\quad\smallcaps{\newlinetospace{\plaintitle}}}% book title 46 | \fancyhead[RO]{\smallcaps{\newlinetospace{\leftmark}}\quad\thepage}% chapter title 47 | }% 48 | {% one-side 49 | \fancyhead[RE,RO]{\smallcaps{\newlinetospace{\plaintitle}}\quad\thepage}% book title 50 | }% 51 | } 52 | 53 | 54 | %% 55 | % The back matter contains appendices, indices, glossaries, endnotes, 56 | % biliographies, list of contributors, illustration credits, etc. 57 | \renewcommand\backmatter{% 58 | \if@openright% 59 | \cleardoublepage% 60 | \else% 61 | \clearpage% 62 | \fi% 63 | \@mainmatterfalse% 64 | } 65 | 66 | %% 67 | % Only show the chapter titles in the table of contents 68 | \setcounter{tocdepth}{0} 69 | 70 | %% 71 | % If there is a `tufte-book-local.sty' file, load it. 72 | 73 | \IfFileExists{tufte-book-local.tex} 74 | {\input{tufte-book-local} 75 | \TufteInfoNL{Loading tufte-book-local.tex}} 76 | {} 77 | 78 | %% 79 | % End of file 80 | \endinput 81 | -------------------------------------------------------------------------------- /2019/2019-2/2-15-rb-tree/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-2/2-15-rb-tree/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-2/2-2-efficiency/2-2-efficiency.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-2-efficiency/2-2-efficiency.pdf -------------------------------------------------------------------------------- /2019/2019-2/2-2-efficiency/2-2-efficiency.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-2-efficiency/2-2-efficiency.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-2/2-2-efficiency/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | ## Homework 4 | 5 | ### OLD 6 | - DH 第6章练习 1, 8, 10, 13, 18 7 | 8 | ### NEW 9 | - DH 第6章练习 18, 19, 20 (a) 10 | - TC 3.1-6, 3.1-7, Problem 3-3 (a; Try Your Best) 11 | 12 | ### Additional 13 | - DH 第6章练习 13 14 | 15 | ## OT 16 | 17 | ### OLD 18 | - Algorithmic Gap 19 | - Asymptotic Notations 20 | 21 | ### NEW 22 | - Decision Tree 23 | - Aderversary Argument -------------------------------------------------------------------------------- /2019/2019-2/2-2-efficiency/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-2/2-2-efficiency/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-2/2-3-counting/2-3-counting.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-3-counting/2-3-counting.pdf -------------------------------------------------------------------------------- /2019/2019-2/2-3-counting/2-3-counting.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-3-counting/2-3-counting.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-2/2-3-counting/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | ## Homework 4 | 5 | ### OLD 6 | - CS 1.1 节 13 7 | - CS 1.2 节 5, 15 8 | - CS 1.5 节 4, 12, 14 9 | 10 | ### NEW 11 | - CS 1.2 节 1, 5, 6, 15 12 | - CS 1.5 节 4, 12 13 | 14 | ### Additional 15 | - 算法计数题目 16 | 17 | ## OT 18 | 19 | ### OLD 20 | - The twelvefold way (1) 21 | - The twelvefold way (2) 22 | 23 | ### NEW 24 | - Sums? 25 | - Binomial Coefficients? -------------------------------------------------------------------------------- /2019/2019-2/2-3-counting/algs/conundrum.tex: -------------------------------------------------------------------------------- 1 | % conundrum.tex 2 | 3 | \begin{algorithm}[H] 4 | \begin{algorithmic}[1] 5 | \Procedure{Conundrum}{$n$} 6 | \State $r \gets 0$ 7 | 8 | \hStatex 9 | \For{$i \gets 1 \;\text{\bf to } n$} 10 | \For{$j \gets i+1 \;\text{\bf to } n$} 11 | \For{$k \gets i+j-1 \;\text{\bf to } n$} 12 | \State $r \gets r + 1$ 13 | \EndFor 14 | \EndFor 15 | \EndFor 16 | 17 | \hStatex 18 | \State \Return $r$ 19 | \EndProcedure 20 | \end{algorithmic} 21 | \end{algorithm} -------------------------------------------------------------------------------- /2019/2019-2/2-3-counting/counting.bib: -------------------------------------------------------------------------------- 1 | @book{Book:GKP, 2 | author = {Graham, Ronald L. and Knuth, Donald E. and Patashnik, Oren}, 3 | title = {Concrete Mathematics: A Foundation for Computer Science}, 4 | year = {1994}, 5 | isbn = {0201558025}, 6 | publisher = {Addison-Wesley Longman Publishing Co., Inc.}, 7 | address = {USA}, 8 | edition = {2nd} 9 | } -------------------------------------------------------------------------------- /2019/2019-2/2-3-counting/figs/einstein-count.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-3-counting/figs/einstein-count.jpg -------------------------------------------------------------------------------- /2019/2019-2/2-3-counting/tufte-book.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-book}[2009/12/11 v3.5.0 Tufte-book class] 4 | 5 | %% 6 | % Declare we're tufte-book 7 | \newcommand{\@tufte@class}{book}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-book}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any book-specific stuff now 17 | 18 | %% 19 | % The front matter in Tufte's /Beautiful Evidence/ contains everything up 20 | % to the opening page of Chapter 1. The running heads, when they appear, 21 | % contain only the (arabic) page number in the outside corner. 22 | %\newif\if@mainmatter \@mainmattertrue 23 | \renewcommand\frontmatter{% 24 | \cleardoublepage% 25 | \@mainmatterfalse% 26 | \pagenumbering{arabic}% 27 | %\pagestyle{plain}% 28 | \fancyhf{}% 29 | \ifthenelse{\boolean{@tufte@twoside}}% 30 | {\fancyhead[LE,RO]{\thepage}}% 31 | {\fancyhead[RE,RO]{\thepage}}% 32 | } 33 | 34 | 35 | %% 36 | % The main matter in Tufte's /Beautiful Evidence/ doesn't restart the page 37 | % numbering---it continues where it left off in the front matter. 38 | \renewcommand\mainmatter{% 39 | \cleardoublepage% 40 | \@mainmattertrue% 41 | \fancyhf{}% 42 | \ifthenelse{\boolean{@tufte@twoside}}% 43 | {% two-side 44 | \renewcommand{\chaptermark}[1]{\markboth{##1}{}}% 45 | \fancyhead[LE]{\thepage\quad\smallcaps{\newlinetospace{\plaintitle}}}% book title 46 | \fancyhead[RO]{\smallcaps{\newlinetospace{\leftmark}}\quad\thepage}% chapter title 47 | }% 48 | {% one-side 49 | \fancyhead[RE,RO]{\smallcaps{\newlinetospace{\plaintitle}}\quad\thepage}% book title 50 | }% 51 | } 52 | 53 | 54 | %% 55 | % The back matter contains appendices, indices, glossaries, endnotes, 56 | % biliographies, list of contributors, illustration credits, etc. 57 | \renewcommand\backmatter{% 58 | \if@openright% 59 | \cleardoublepage% 60 | \else% 61 | \clearpage% 62 | \fi% 63 | \@mainmatterfalse% 64 | } 65 | 66 | %% 67 | % Only show the chapter titles in the table of contents 68 | \setcounter{tocdepth}{0} 69 | 70 | %% 71 | % If there is a `tufte-book-local.sty' file, load it. 72 | 73 | \IfFileExists{tufte-book-local.tex} 74 | {\input{tufte-book-local} 75 | \TufteInfoNL{Loading tufte-book-local.tex}} 76 | {} 77 | 78 | %% 79 | % End of file 80 | \endinput 81 | -------------------------------------------------------------------------------- /2019/2019-2/2-3-counting/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-2/2-3-counting/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-2/2-4-recurrence/2-4-recurrence.bib: -------------------------------------------------------------------------------- 1 | % 2-4-recurrence.bib 2 | 3 | @article{ABMethod, 4 | author = {Akra, Mohamad and Bazzi, Louay}, 5 | title = {On the Solution of Linear Recurrence Equations}, 6 | year = {1998}, 7 | issue_date = {May 1998}, 8 | publisher = {Kluwer Academic Publishers}, 9 | address = {USA}, 10 | volume = {10}, 11 | number = {2}, 12 | issn = {0926-6003}, 13 | url = {https://doi.org/10.1023/A:1018353700639}, 14 | doi = {10.1023/A:1018353700639}, 15 | journal = {Comput. Optim. Appl.}, 16 | month = may, 17 | pages = {195–210}, 18 | numpages = {16}, 19 | } 20 | 21 | @book{AoA, 22 | author = {Sedgewick, Robert and Flajolet, Philippe}, 23 | title = {An Introduction to the Analysis of Algorithms}, 24 | year = {1996}, 25 | isbn = {020140009X}, 26 | publisher = {Addison-Wesley Longman Publishing Co., Inc.}, 27 | address = {USA} 28 | } 29 | 30 | @book{TAOCP-Vol3, 31 | author = {Knuth, Donald E.}, 32 | title = {The Art of Computer Programming,  Volume 3: (2nd Ed.) Sorting and Searching}, 33 | year = {1998}, 34 | isbn = {0201896850}, 35 | publisher = {Addison Wesley Longman Publishing Co., Inc.}, 36 | address = {USA} 37 | } -------------------------------------------------------------------------------- /2019/2019-2/2-4-recurrence/2-4-recurrence.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-4-recurrence/2-4-recurrence.pdf -------------------------------------------------------------------------------- /2019/2019-2/2-4-recurrence/2-4-recurrence.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-4-recurrence/2-4-recurrence.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-2/2-4-recurrence/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | ## Homework 4 | 5 | ### OLD 6 | - TC 第 4.1 节练习 5 7 | - TC 第 4.3 节练习 3 8 | - TC 第 4.4 节练习 2 9 | - TC 第 4.5 节练习 3 10 | - TC 第 4 章问题 4 11 | 12 | ### NEW 13 | - TC 4.1-5 14 | - TC 4.3-3 15 | - TC 4.4-5 16 | - TC 4.5-4 17 | - TC Problem 4-1 18 | - TC Problem 4-3 (Except f and j) 19 | 20 | ### Additional 21 | - TC Problem 4-3 (f and j) 22 | 23 | ## OT 24 | 25 | ### OLD 26 | - 证明 The Master Theorem 27 | - 介绍 Akra–Bazzi Method 28 | 29 | ### NEW 30 | - 介绍 Akra–Bazzi Method 31 | - 深入分析 MergeSort -------------------------------------------------------------------------------- /2019/2019-2/2-4-recurrence/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-2/2-4-recurrence/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-2/2-5-solving-recurrence/2-5-solving-recurrence.bib: -------------------------------------------------------------------------------- 1 | % 2-5-solving-recurrence.bib 2 | 3 | @book{Book:GKP, 4 | author = {Graham, Ronald L. and Knuth, Donald E. and Patashnik, Oren}, 5 | title = {Concrete Mathematics: A Foundation for Computer Science}, 6 | year = {1994}, 7 | isbn = {0201558025}, 8 | publisher = {Addison-Wesley Longman Publishing Co., Inc.}, 9 | address = {USA}, 10 | edition = {2nd} 11 | } -------------------------------------------------------------------------------- /2019/2019-2/2-5-solving-recurrence/2-5-solving-recurrence.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-5-solving-recurrence/2-5-solving-recurrence.pdf -------------------------------------------------------------------------------- /2019/2019-2/2-5-solving-recurrence/2-5-solving-recurrence.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-5-solving-recurrence/2-5-solving-recurrence.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-2/2-5-solving-recurrence/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | ## Homework 4 | 5 | ### OLD 6 | - CS 第4.1节问题 16, 17 7 | - CS 第4.2节问题 8, 11 8 | - CS 第4.3节问题 9 9 | - CS 第4.4节问题 1, 6 10 | - CS 第4.5节问题 8, 9, 10 11 | 12 | ### NEW 13 | - CS 第4.1节问题 16 14 | - CS 第4.2节问题 11 15 | - CS 第4.3节问题 9(c), 18 16 | - CS 第4.5节问题 8, 10 17 | 18 | ### Additional 19 | - a_n = 2a_{n-1} + a_{n-2} - 2a_{n-3} for n > 3 20 | 21 | ## OT 22 | 23 | ### OLD 24 | - Josephus Problem 25 | - Generating Function 26 | 27 | ### NEW 28 | - Josephus Problem 29 | - Generating Function -------------------------------------------------------------------------------- /2019/2019-2/2-5-solving-recurrence/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-2/2-5-solving-recurrence/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-2/2-6-algorithmic-methods/2-6-algorithmic-methods.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-6-algorithmic-methods/2-6-algorithmic-methods.pdf -------------------------------------------------------------------------------- /2019/2019-2/2-6-algorithmic-methods/2-6-algorithmic-methods.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-6-algorithmic-methods/2-6-algorithmic-methods.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-2/2-6-algorithmic-methods/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | ## Homework 4 | 5 | ### OLD 6 | - DH 第 4 章练习 1, 8, 9, 12, 14 7 | 8 | ### NEW 9 | - DH 第 4 章练习 8, 9, 12, 13 10 | 11 | ### Additional 12 | - Closest-pair Problem (DH 4-10) 13 | 14 | ## OT 15 | 16 | ### OLD 17 | - Alpha-Beta 剪枝 18 | - SAT 求解算法 19 | 20 | ### NEW 21 | - Alpha-Beta 剪枝 22 | - SAT 求解算法 -------------------------------------------------------------------------------- /2019/2019-2/2-6-algorithmic-methods/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-2/2-6-algorithmic-methods/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-2/2-7-discrete-probability/2-7-discrete-probability.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-7-discrete-probability/2-7-discrete-probability.pdf -------------------------------------------------------------------------------- /2019/2019-2/2-7-discrete-probability/2-7-discrete-probability.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-7-discrete-probability/2-7-discrete-probability.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-2/2-7-discrete-probability/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | ## Homework 4 | 5 | ### OLD 6 | - CS 第 5.1 节问题 10, 12 7 | - CS 第 5.2 节问题 4, 10 8 | - CS 第 5.3 节问题 2, 6, 12 9 | - CS 第 5.4 节问题 4, 10, 12 ("Solve Problem 10" 改为 "Solve Problem 11"), 15 10 | 11 | ### NEW 12 | - CS 第 5.1 节问题 10, 12 13 | - CS 第 5.2 节问题 4, 10 14 | - CS 第 5.3 节问题 2, 12 15 | - CS 第 5.4 节问题 10, 15 16 | 17 | ### Additional 18 | - The Ballot Problem (Example 3.27 of Ross) 19 | 20 | ## OT 21 | 22 | ### OLD 23 | - Monty Hall Problem 24 | - TC Problem 5.2: Searching an unsorted array 25 | 26 | ### NEW 27 | - Monty Hall Problem 28 | - Shuffling cards ("Proofs from THE Book") -------------------------------------------------------------------------------- /2019/2019-2/2-7-discrete-probability/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-2/2-7-discrete-probability/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-2/2-8-probabilistic-analysis/2-8-probabilistic-analysis.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-8-probabilistic-analysis/2-8-probabilistic-analysis.pdf -------------------------------------------------------------------------------- /2019/2019-2/2-8-probabilistic-analysis/2-8-probabilistic-analysis.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-8-probabilistic-analysis/2-8-probabilistic-analysis.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-2/2-8-probabilistic-analysis/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | ## Homework 4 | 5 | ### OLD 6 | - CS 第 5.6 节问题 4, 8 7 | - CS 第 5.7 节问题 2, 4, 6, 12 8 | - TC 第 5.2 节练习 4, 5 9 | - TC 第 5.3 节练习 2, 3, 4 10 | 11 | ### NEW 12 | - CS 第 5.6 节问题 4, 8 13 | - CS 第 5.7 节问题 2, 12 14 | - TC 第 5.2 节练习 4, 5 15 | - TC 第 5.3 节练习 3, 4 16 | - TC Problem 5-2 ($e, f, g$) 17 | 18 | ### Additional 19 | - Coin Pattern (Provided by Yifan Pei) 20 | 21 | ## OT 22 | 23 | ### OLD 24 | - TC Problem 7.4: Stack depth for quicksort 25 | - Random-Selection 算法的期望时间复杂度 26 | 27 | ### NEW 28 | - [Stanford Lecture - Don Knuth- The Analysis of Algorithms.mp4](https://box.nju.edu.cn/f/7fda9901c7784314b3a6/) 29 | - Average-case Analysis of Binary Search (TAOCP Vol 3) -------------------------------------------------------------------------------- /2019/2019-2/2-8-probabilistic-analysis/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-2/2-8-probabilistic-analysis/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-2/2-9-sorting-selection/2-9-sorting-selection.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-9-sorting-selection/2-9-sorting-selection.pdf -------------------------------------------------------------------------------- /2019/2019-2/2-9-sorting-selection/2-9-sorting-selection.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2-9-sorting-selection/2-9-sorting-selection.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-2/2-9-sorting-selection/README.md: -------------------------------------------------------------------------------- 1 | # README.md 2 | 3 | ## Homework 4 | 5 | ### OLD 6 | - TC 第七章: 7 | - Exercises: 7.1-3, 7.2-4, 7.3-2, 7.4-2 8 | - Problem: 7-5 9 | - TC 第八章: 10 | - Exercises: 8.1-4, 8.2-4, 8.3-4, 8.4-2 11 | - Problem: 8-2 12 | - TC 第九章 13 | - Exercises: 9.1-1, 9.3-7 14 | 15 | ### NEW 16 | - TC 7.2-2, 7.3-2, 7.4-2 17 | - TC 8.1-4, 8.2-4, 8.3-4, Problem 8-2 18 | - TC 9.1-1, 9.3-7 19 | 20 | ### Additional 21 | - TC Problem 7-5 22 | 23 | ## OT 24 | 25 | ### OLD 26 | - TC Problem 7.4 27 | - Random-Selection 算法的平均情况时间复杂度 28 | 29 | ### NEW 30 | - Analysis of Quicksort 31 | - Sorting algorithms -------------------------------------------------------------------------------- /2019/2019-2/2-9-sorting-selection/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-2/2-9-sorting-selection/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /2019/2019-2/2019-2-correction/2019-2-correction.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2019-2-correction/2019-2-correction.pdf -------------------------------------------------------------------------------- /2019/2019-2/2019-2-correction/2019-2-correction.tex: -------------------------------------------------------------------------------- 1 | % 2-correction.tex 2 | 3 | %%%%%%%%%%%%%%%%%%%% 4 | \documentclass[a4paper, justified]{tufte-handout} 5 | 6 | \input{hw-preamble} % feel free to modify this file 7 | %%%%%%%%%%%%%%%%%%%% 8 | \title{2019-2: 订正} 9 | \me{魏恒峰}{hfwei@nju.edu.cn}{}{} 10 | \date{\zhtoday} % or like 2019年9月13日 11 | %%%%%%%%%%%%%%%%%%%% 12 | \begin{document} 13 | \maketitle 14 | %%%%%%%%%%%%%%%%%%%% 15 | \noplagiarism % always keep this line 16 | %%%%%%%%%%%%%%%%%%%% 17 | \begin{abstract} 18 | % \begin{center}{\fcolorbox{blue}{yellow!60}{\parbox{0.65\textwidth}{\large 19 | % \begin{itemize} 20 | % \item 21 | % \end{itemize}}}} 22 | % \end{center} 23 | \end{abstract} 24 | %%%%%%%%%%%%%%%%%%%% 25 | % \beginrequired 26 | 27 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 28 | \section{Correctness} 29 | 30 | %%%%%%%%%%%%%%% 31 | \begin{problem}[DH Problem 5.8] 32 | \end{problem} 33 | 34 | \begin{solution} 35 | \end{solution} 36 | %%%%%%%%%%%%%%% 37 | 38 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 39 | \setcounter{section}{2} % using this to reset section counter 40 | \section{Counting} 41 | 42 | %%%%%%%%%%%%%%% 43 | \setcounter{problem}{2} % using this to reset problem counter 44 | \begin{problem}[CS 1.2-6] 45 | \end{problem} 46 | 47 | \begin{solution} 48 | \end{solution} 49 | %%%%%%%%%%%%%%% 50 | 51 | %%%%%%%%%%%%%%%%%%%% 52 | % 如果没有反馈,可以把这部分删掉 53 | \section*{选做 (推荐)} 54 | 55 | 问题求解课程(包括习题课、OT)反馈、感想、批评、意见、建议、吐槽。 56 | 57 | \begin{itemize} 58 | \item 可长可短 59 | \item 可匿名 60 | \item 可约谈 61 | \item 截止日期: $\infty$ 62 | \end{itemize} 63 | 64 | 邮件: hfwei@nju.edu.cn 65 | 66 | 信箱: 计算机系二楼 H016 信箱 67 | %%%%%%%%%%%%%%%%%%%% 68 | \end{document} -------------------------------------------------------------------------------- /2019/2019-2/2019-2-correction/2019-2-correction.tex.latexmain: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/courses-at-nju-by-hfwei/problem-solving-class-problems/a2f3011676cc7251d63fbc81c580192e9aadb41e/2019/2019-2/2019-2-correction/2019-2-correction.tex.latexmain -------------------------------------------------------------------------------- /2019/2019-2/2019-2-correction/README.md: -------------------------------------------------------------------------------- 1 | # README.md -------------------------------------------------------------------------------- /2019/2019-2/2019-2-correction/tufte-handout.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 2 | 3 | \ProvidesClass{tufte-handout}[2009/12/11 v3.5.0 Tufte-handout class] 4 | 5 | %% 6 | % Declare we're tufte-handout 7 | \newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) 8 | \newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) 9 | 10 | %% 11 | % Load the common style elements 12 | \input{tufte-common.def} 13 | 14 | 15 | %% 16 | % Set up any handout-specific stuff now 17 | 18 | %% 19 | % Abstract 20 | 21 | % TODO The abstract should be printed on its own page of the `titlepage' 22 | % option was specified. 23 | \renewenvironment{abstract} 24 | {\begin{quotation}\if@tufte@sfsidenotes\begin{sffamily}\fi} 25 | {\if@tufte@sfsidenotes\end{sffamily}\fi\end{quotation}} 26 | 27 | 28 | %% 29 | % If there is a `tufte-handout-local.tex' file, load it. 30 | 31 | \IfFileExists{tufte-handout-local.tex} 32 | {\input{tufte-handout-local} 33 | \TufteInfoNL{Loading tufte-handout-local.tex}} 34 | {} 35 | 36 | 37 | %% 38 | % End of file 39 | \endinput 40 | -------------------------------------------------------------------------------- /2019/2019-2/2019-2-correction/tufte-preamble.tex: -------------------------------------------------------------------------------- 1 | % \geometry{showframe}% for debugging purposes -- displays the margins 2 | 3 | % Set up the images/graphics package 4 | \usepackage{graphicx} 5 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 6 | % \graphicspath{{figs/}} 7 | 8 | % The following package makes prettier tables. We're all about the bling! 9 | \usepackage{booktabs} 10 | 11 | % The units package provides nice, non-stacked fractions and better spacing for units. 12 | \usepackage{units} 13 | 14 | % Small sections of multiple columns 15 | \usepackage{multicol} 16 | 17 | % Provides paragraphs of dummy text 18 | \usepackage{lipsum} 19 | 20 | % These commands are used to pretty-print LaTeX commands 21 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 22 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 23 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 24 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 25 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 26 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 27 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 28 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 hengxin(Hengfeng Wei) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # problem-solving-class-problems 2 | 3 | Problem Sets for the Problem Solving Class. 4 | 5 | For the solutions, please go to 6 | [problem-solving-class-problem-solution](https://github.com/hengxin/problem-solving-class-problem-solution). 7 | 8 | ## How to Contribute? 9 | - Open an [issue](https://github.com/hengxin/problem-solving-class-problems/issues/17) 10 | for each problem you want to submit. 11 | - Describe your problem briefly in the issue template. 12 | - Note: Problems may be rejected. 13 | 14 | ## Contributors 15 | - Yifan Pei 16 | - Bingkun Huang 17 | - Ruize Tang 18 | - Hengfeng Wei (hfwei@nju.edu.cn) 19 | 20 | ## Acknowledgment 21 | 22 | This handout template we use is developed by The Tufte-LaTeX Developers 23 | for producing handouts according to the style of Edward R. Tufte. 24 | For more information, please visit [Tufte-Style Handout @ ShareLaTeX](https://www.sharelatex.com/templates/other/tufte-style-handout). 25 | --------------------------------------------------------------------------------