implemented algorithm
This commit is contained in:
parent
db163b0ab2
commit
7f7b24a046
2 changed files with 30 additions and 1 deletions
Binary file not shown.
|
|
@ -73,7 +73,7 @@ algorithm from the paper by \citeauthor{My colleague et al.} Which is the curren
|
||||||
industry standard. Notice the code has a runtime complexity of $\mathcal{O}(n^2)$.
|
industry standard. Notice the code has a runtime complexity of $\mathcal{O}(n^2)$.
|
||||||
|
|
||||||
\begin{algorithm}
|
\begin{algorithm}
|
||||||
\caption{Conventional sock sorting}\label{euclid}
|
\caption{Conventional sock sorting}
|
||||||
\begin{algorithmic}[1]
|
\begin{algorithmic}[1]
|
||||||
\State\Comment initialize a new laundry basket with a given set of laundry
|
\State\Comment initialize a new laundry basket with a given set of laundry
|
||||||
\State $A\gets\Lambda$\Comment WLOG assume $\forall\mathscr{L}\in\Lambda|\mathscr{L}$ is a sock
|
\State $A\gets\Lambda$\Comment WLOG assume $\forall\mathscr{L}\in\Lambda|\mathscr{L}$ is a sock
|
||||||
|
|
@ -121,7 +121,36 @@ obsolete.
|
||||||
\end{figure}
|
\end{figure}
|
||||||
|
|
||||||
\section{Algorithm}
|
\section{Algorithm}
|
||||||
|
Making use of the novel advanced features of a "drying rack" we are able to
|
||||||
|
implement the following algorithm in $\mathscr{O}(n)$:\\
|
||||||
|
\begin{algorithm}
|
||||||
|
\caption{\acronym}
|
||||||
|
\begin{algorithmic}[1]
|
||||||
|
\State\Comment initialize a new laundry basket with a given set of laundry
|
||||||
|
\State $A\gets\Lambda$\Comment WLOG assume $\forall\mathscr{L}\in\Lambda|\mathscr{L}$ is a sock
|
||||||
|
\State $\text{matches}\gets []$
|
||||||
|
\State $\daleth\gets []$ \Comment{Create a new empty drying rack}
|
||||||
|
\Repeat
|
||||||
|
\State $\mathscr{L}\gets $ A.get
|
||||||
|
\State result $\gets$ $\daleth$.match($\mathscr{L}$)
|
||||||
|
\If{result $\ne\mathscr{L}_0$}
|
||||||
|
\State matches.append(result)
|
||||||
|
\Else
|
||||||
|
\State $\daleth$.put($\mathscr{L}$)
|
||||||
|
\EndIf
|
||||||
|
|
||||||
|
\Until{$\mathscr{L}\ne\mathscr{L}_0$}
|
||||||
|
\end{algorithmic}
|
||||||
|
\end{algorithm}
|
||||||
|
As evident from the algorithm above, only one loop performing
|
||||||
|
operations which are all in $\mathscr{O}(1)$ is required thus
|
||||||
|
putting the algorithm in a $\mathscr{O}(n)$ runtime complexity
|
||||||
|
class. Assuming that $\forall\mathscr{L}\in\Lambda\exists\mathscr{L}^{-1}|\mathscr{L}\cong\mathscr{L}^{-1}$
|
||||||
|
the algorithm always yields a correct solution for the problem
|
||||||
|
(proof is left as an exercise to the reader).
|
||||||
\section{Discussion and Results}
|
\section{Discussion and Results}
|
||||||
|
To evaluate the algorithms performance it has been executed
|
||||||
|
on different platforms consisting of diverse hardware:
|
||||||
|
|
||||||
|
|
||||||
\section{Conclusion}
|
\section{Conclusion}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue