正如标题所暗示的,我正在尝试编译一个 tex 文件,但它在显示消息后挂起了
"This is pdfTeX, Version 3.14159265-2.6-1.40.18 (MiKTeX 2.9.6500 64-bit)
entering extended mode
("D:/math assignments/TeX/Compass3.tex"
LaTeX2e <2017-04-15>
Babel <3.15> and hyphenation patterns for 75 language(s) loaded.
)
*"
我正在使用 TeXworks pdfLaTex+MakeIndex+BibTex
我的代码如下
\documentclass[12pt]{article}
\title{COMP 2823: Asignment 5}
\author{Student ID: Student Number}
\date{}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{fancyhdr}
\usepackage{ulem}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{algorithmicx}
\usepackage{algpseudocode}
\pgfplotsset{compat=1.16}
\pagestyle{fancy}
\fancyhf{}
\rhead{SID: Student Number}
\begin{document}
\pagenumbering{gobble}
\maketitle
\tableofcontents
\pagenumbering{arabic}
\newpage
\setlength{\parindent}{0cm}
\section{}
\subsection{Algorithm/Completeness}
Scan the array once to determine the element with the least priority. This
element is necessarily the root of our tree if we are to satisfy the heap
order requirement. Sort the remaining elements into two arrays, those with
keys less than that of the root and those with keys greater. Repeat the
procedure recursively on the two arrays to create the left and right
subtrees of the root respectively. These two scans require $n + (n - 1)\leq
2n$ comparisons (one scan over all of the elements to determine the element
with the least priority and one scan over all the remaining elements to sort
the elements into the two sub arrays). Note that at each level of the tree,
the total number of pairs that need to be scanned is no more than $n-k+1$,
where $k$ is the depth of the recursion because an element is removed from
the pool of pairs yet to be inserted into the tree each time the function is
called. $\therefore$
\subsection{Complexity}
\begin{align*}
f(n) &\leq \sum_{k=0}^{n}2k \\
&\leq 2\sum_{k=0}^{n}k \\
&\leq \frac{2n(n+1)}{2} \\
&\leq n(n+1) \\
\therefore \text{ } f(n) &\in O(n^{2})
\end{align*}
\newpage
\subsection{Pseudo Code}
\begin{algorithmic}[1]
\Procedure{BSH}{Array}
Tree $\gets$ BinarySearchHeap(Null)
\State Node MinP, MinK $\gets$ Array[0], Array[0].Priority, Array[0].Key
\For{Pair in Array}
\If{Pair[Priority] $<$ MinP}
\State Node $\gets$ Pair
\State MinP $\gets$ Pair.Priority
\State MinK $\gets$ Pair.Key
\EndIf
\EndFor
\State Tree.Root $\gets$ Node
\State Array.Remove(Node)
\State Lesser, Greater $\gets$ [], []
\For{Pair in Array}
\If{Pair.Key < MinK}
\State Lesser.Append(Pair)
\Else
\State Greater.Append(Pair)
\EndIf
\EndFor
\State Tree.Root.Left $\gets$ BSH(Lesser)
\State Tree.Root.Left $\gets$ BSH(Greater)
\State \Return Tree
\EndProcedure
\end{algorithmic}
\section{Insertion}
\subsection{algorithm}
The algorithm will consist of two stages, an initial Binary Search Tree
isertion and then a modified upheap procedure to attain the heap property
while preserving the Binary Search Tree property. \\
Assume that at some point on our algorthm the tree is a Binary Search Tree,
the subtree rooted at the new node is a valid Binary Search Heap, and that
the entire tree barring the new node preserves the Heap Property, (note that
if the enitrety of the tree including the new node satisfies the Binary
Search Heap property then our algorithm is complete). By assumption, the new
node has priority lesser than its parent. Suppose it is the right child of
it's parent, We make the new node the child of it's parent's parent (or the
root if its parent was the root). Note that the new node's parent had lesser
priority than any of the new node's children, and is lesser than the new
node. We make the new node's parent the left child of the new node, note
that since the new node was the right child of its parent originally, the
parent has a vacancy for a right child. Since all the children of the new
node were greater than its parent, the subtree rooted at its (the new
node's) is composed of elements greater than the old parent and has greater
priority, and therefore appending it as the right child of the old parent
will preserve the Binary Search Heap properties.
\end{document}
昨天还运行正常,但今天却无法编译,我认为自那时起我唯一添加/更改的是“插入”部分。