Rename year directories to allow natural ordering

This commit is contained in:
2023-12-20 03:57:27 +00:00
parent 0ab1f5ad3a
commit 1f7d812b98
1895 changed files with 0 additions and 7188 deletions

View File

@ -1,87 +0,0 @@
<?xml version="1.0" standalone="yes"?>
<!-- logreq request file -->
<!-- logreq version 1.0 / dtd version 1.0 -->
<!-- Do not edit this file! -->
<!DOCTYPE requests [
<!ELEMENT requests (internal | external)*>
<!ELEMENT internal (generic, (provides | requires)*)>
<!ELEMENT external (generic, cmdline?, input?, output?, (provides | requires)*)>
<!ELEMENT cmdline (binary, (option | infile | outfile)*)>
<!ELEMENT input (file)+>
<!ELEMENT output (file)+>
<!ELEMENT provides (file)+>
<!ELEMENT requires (file)+>
<!ELEMENT generic (#PCDATA)>
<!ELEMENT binary (#PCDATA)>
<!ELEMENT option (#PCDATA)>
<!ELEMENT infile (#PCDATA)>
<!ELEMENT outfile (#PCDATA)>
<!ELEMENT file (#PCDATA)>
<!ATTLIST requests
version CDATA #REQUIRED
>
<!ATTLIST internal
package CDATA #REQUIRED
priority (9) #REQUIRED
active (0 | 1) #REQUIRED
>
<!ATTLIST external
package CDATA #REQUIRED
priority (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8) #REQUIRED
active (0 | 1) #REQUIRED
>
<!ATTLIST provides
type (static | dynamic | editable) #REQUIRED
>
<!ATTLIST requires
type (static | dynamic | editable) #REQUIRED
>
<!ATTLIST file
type CDATA #IMPLIED
>
]>
<requests version="1.0">
<internal package="biblatex" priority="9" active="0">
<generic>latex</generic>
<provides type="dynamic">
<file>main.bcf</file>
</provides>
<requires type="dynamic">
<file>main.bbl</file>
</requires>
<requires type="static">
<file>blx-dm.def</file>
<file>blx-compat.def</file>
<file>biblatex.def</file>
<file>standard.bbx</file>
<file>numeric.bbx</file>
<file>numeric.cbx</file>
<file>biblatex.cfg</file>
<file>german.lbx</file>
<file>ngerman.lbx</file>
<file>english.lbx</file>
</requires>
</internal>
<external package="biblatex" priority="5" active="0">
<generic>biber</generic>
<cmdline>
<binary>biber</binary>
<infile>main</infile>
</cmdline>
<input>
<file>main.bcf</file>
</input>
<output>
<file>main.bbl</file>
</output>
<provides type="dynamic">
<file>main.bbl</file>
</provides>
<requires type="dynamic">
<file>main.bcf</file>
</requires>
<requires type="editable">
<file>ecl.bib</file>
</requires>
</external>
</requests>

View File

@ -1,87 +0,0 @@
<?xml version="1.0" standalone="yes"?>
<!-- logreq request file -->
<!-- logreq version 1.0 / dtd version 1.0 -->
<!-- Do not edit this file! -->
<!DOCTYPE requests [
<!ELEMENT requests (internal | external)*>
<!ELEMENT internal (generic, (provides | requires)*)>
<!ELEMENT external (generic, cmdline?, input?, output?, (provides | requires)*)>
<!ELEMENT cmdline (binary, (option | infile | outfile)*)>
<!ELEMENT input (file)+>
<!ELEMENT output (file)+>
<!ELEMENT provides (file)+>
<!ELEMENT requires (file)+>
<!ELEMENT generic (#PCDATA)>
<!ELEMENT binary (#PCDATA)>
<!ELEMENT option (#PCDATA)>
<!ELEMENT infile (#PCDATA)>
<!ELEMENT outfile (#PCDATA)>
<!ELEMENT file (#PCDATA)>
<!ATTLIST requests
version CDATA #REQUIRED
>
<!ATTLIST internal
package CDATA #REQUIRED
priority (9) #REQUIRED
active (0 | 1) #REQUIRED
>
<!ATTLIST external
package CDATA #REQUIRED
priority (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8) #REQUIRED
active (0 | 1) #REQUIRED
>
<!ATTLIST provides
type (static | dynamic | editable) #REQUIRED
>
<!ATTLIST requires
type (static | dynamic | editable) #REQUIRED
>
<!ATTLIST file
type CDATA #IMPLIED
>
]>
<requests version="1.0">
<internal package="biblatex" priority="9" active="1">
<generic>latex</generic>
<provides type="dynamic">
<file>main.bcf</file>
</provides>
<requires type="dynamic">
<file>main.bbl</file>
</requires>
<requires type="static">
<file>blx-dm.def</file>
<file>blx-compat.def</file>
<file>biblatex.def</file>
<file>standard.bbx</file>
<file>numeric.bbx</file>
<file>numeric.cbx</file>
<file>biblatex.cfg</file>
<file>german.lbx</file>
<file>ngerman.lbx</file>
<file>english.lbx</file>
</requires>
</internal>
<external package="biblatex" priority="5" active="1">
<generic>biber</generic>
<cmdline>
<binary>biber</binary>
<infile>main</infile>
</cmdline>
<input>
<file>main.bcf</file>
</input>
<output>
<file>main.bbl</file>
</output>
<provides type="dynamic">
<file>main.bbl</file>
</provides>
<requires type="dynamic">
<file>main.bcf</file>
</requires>
<requires type="editable">
<file>ecl.bib</file>
</requires>
</external>
</requests>

View File

@ -1,87 +0,0 @@
<?xml version="1.0" standalone="yes"?>
<!-- logreq request file -->
<!-- logreq version 1.0 / dtd version 1.0 -->
<!-- Do not edit this file! -->
<!DOCTYPE requests [
<!ELEMENT requests (internal | external)*>
<!ELEMENT internal (generic, (provides | requires)*)>
<!ELEMENT external (generic, cmdline?, input?, output?, (provides | requires)*)>
<!ELEMENT cmdline (binary, (option | infile | outfile)*)>
<!ELEMENT input (file)+>
<!ELEMENT output (file)+>
<!ELEMENT provides (file)+>
<!ELEMENT requires (file)+>
<!ELEMENT generic (#PCDATA)>
<!ELEMENT binary (#PCDATA)>
<!ELEMENT option (#PCDATA)>
<!ELEMENT infile (#PCDATA)>
<!ELEMENT outfile (#PCDATA)>
<!ELEMENT file (#PCDATA)>
<!ATTLIST requests
version CDATA #REQUIRED
>
<!ATTLIST internal
package CDATA #REQUIRED
priority (9) #REQUIRED
active (0 | 1) #REQUIRED
>
<!ATTLIST external
package CDATA #REQUIRED
priority (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8) #REQUIRED
active (0 | 1) #REQUIRED
>
<!ATTLIST provides
type (static | dynamic | editable) #REQUIRED
>
<!ATTLIST requires
type (static | dynamic | editable) #REQUIRED
>
<!ATTLIST file
type CDATA #IMPLIED
>
]>
<requests version="1.0">
<internal package="biblatex" priority="9" active="0">
<generic>latex</generic>
<provides type="dynamic">
<file>main.bcf</file>
</provides>
<requires type="dynamic">
<file>main.bbl</file>
</requires>
<requires type="static">
<file>blx-dm.def</file>
<file>blx-compat.def</file>
<file>biblatex.def</file>
<file>standard.bbx</file>
<file>numeric.bbx</file>
<file>numeric.cbx</file>
<file>biblatex.cfg</file>
<file>german.lbx</file>
<file>ngerman.lbx</file>
<file>english.lbx</file>
</requires>
</internal>
<external package="biblatex" priority="5" active="0">
<generic>biber</generic>
<cmdline>
<binary>biber</binary>
<infile>main</infile>
</cmdline>
<input>
<file>main.bcf</file>
</input>
<output>
<file>main.bbl</file>
</output>
<provides type="dynamic">
<file>main.bbl</file>
</provides>
<requires type="dynamic">
<file>main.bcf</file>
</requires>
<requires type="editable">
<file>ecl.bib</file>
</requires>
</external>
</requests>

View File

@ -1,85 +0,0 @@
<?xml version="1.0" standalone="yes"?>
<!-- logreq request file -->
<!-- logreq version 1.0 / dtd version 1.0 -->
<!-- Do not edit this file! -->
<!DOCTYPE requests [
<!ELEMENT requests (internal | external)*>
<!ELEMENT internal (generic, (provides | requires)*)>
<!ELEMENT external (generic, cmdline?, input?, output?, (provides | requires)*)>
<!ELEMENT cmdline (binary, (option | infile | outfile)*)>
<!ELEMENT input (file)+>
<!ELEMENT output (file)+>
<!ELEMENT provides (file)+>
<!ELEMENT requires (file)+>
<!ELEMENT generic (#PCDATA)>
<!ELEMENT binary (#PCDATA)>
<!ELEMENT option (#PCDATA)>
<!ELEMENT infile (#PCDATA)>
<!ELEMENT outfile (#PCDATA)>
<!ELEMENT file (#PCDATA)>
<!ATTLIST requests
version CDATA #REQUIRED
>
<!ATTLIST internal
package CDATA #REQUIRED
priority (9) #REQUIRED
active (0 | 1) #REQUIRED
>
<!ATTLIST external
package CDATA #REQUIRED
priority (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8) #REQUIRED
active (0 | 1) #REQUIRED
>
<!ATTLIST provides
type (static | dynamic | editable) #REQUIRED
>
<!ATTLIST requires
type (static | dynamic | editable) #REQUIRED
>
<!ATTLIST file
type CDATA #IMPLIED
>
]>
<requests version="1.0">
<internal package="biblatex" priority="9" active="0">
<generic>latex</generic>
<provides type="dynamic">
<file>CT2109-Assignment-02.bcf</file>
</provides>
<requires type="dynamic">
<file>CT2109-Assignment-02.bbl</file>
</requires>
<requires type="static">
<file>blx-dm.def</file>
<file>blx-compat.def</file>
<file>biblatex.def</file>
<file>standard.bbx</file>
<file>numeric.bbx</file>
<file>numeric.cbx</file>
<file>biblatex.cfg</file>
<file>english.lbx</file>
</requires>
</internal>
<external package="biblatex" priority="5" active="0">
<generic>biber</generic>
<cmdline>
<binary>biber</binary>
<infile>CT2109-Assignment-02</infile>
</cmdline>
<input>
<file>CT2109-Assignment-02.bcf</file>
</input>
<output>
<file>CT2109-Assignment-02.bbl</file>
</output>
<provides type="dynamic">
<file>CT2109-Assignment-02.bbl</file>
</provides>
<requires type="dynamic">
<file>CT2109-Assignment-02.bcf</file>
</requires>
<requires type="editable">
<file>ecl.bib</file>
</requires>
</external>
</requests>

View File

@ -1,85 +0,0 @@
<?xml version="1.0" standalone="yes"?>
<!-- logreq request file -->
<!-- logreq version 1.0 / dtd version 1.0 -->
<!-- Do not edit this file! -->
<!DOCTYPE requests [
<!ELEMENT requests (internal | external)*>
<!ELEMENT internal (generic, (provides | requires)*)>
<!ELEMENT external (generic, cmdline?, input?, output?, (provides | requires)*)>
<!ELEMENT cmdline (binary, (option | infile | outfile)*)>
<!ELEMENT input (file)+>
<!ELEMENT output (file)+>
<!ELEMENT provides (file)+>
<!ELEMENT requires (file)+>
<!ELEMENT generic (#PCDATA)>
<!ELEMENT binary (#PCDATA)>
<!ELEMENT option (#PCDATA)>
<!ELEMENT infile (#PCDATA)>
<!ELEMENT outfile (#PCDATA)>
<!ELEMENT file (#PCDATA)>
<!ATTLIST requests
version CDATA #REQUIRED
>
<!ATTLIST internal
package CDATA #REQUIRED
priority (9) #REQUIRED
active (0 | 1) #REQUIRED
>
<!ATTLIST external
package CDATA #REQUIRED
priority (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8) #REQUIRED
active (0 | 1) #REQUIRED
>
<!ATTLIST provides
type (static | dynamic | editable) #REQUIRED
>
<!ATTLIST requires
type (static | dynamic | editable) #REQUIRED
>
<!ATTLIST file
type CDATA #IMPLIED
>
]>
<requests version="1.0">
<internal package="biblatex" priority="9" active="0">
<generic>latex</generic>
<provides type="dynamic">
<file>CT2109-Assignment-03.bcf</file>
</provides>
<requires type="dynamic">
<file>CT2109-Assignment-03.bbl</file>
</requires>
<requires type="static">
<file>blx-dm.def</file>
<file>blx-compat.def</file>
<file>biblatex.def</file>
<file>standard.bbx</file>
<file>numeric.bbx</file>
<file>numeric.cbx</file>
<file>biblatex.cfg</file>
<file>english.lbx</file>
</requires>
</internal>
<external package="biblatex" priority="5" active="0">
<generic>biber</generic>
<cmdline>
<binary>biber</binary>
<infile>CT2109-Assignment-03</infile>
</cmdline>
<input>
<file>CT2109-Assignment-03.bcf</file>
</input>
<output>
<file>CT2109-Assignment-03.bbl</file>
</output>
<provides type="dynamic">
<file>CT2109-Assignment-03.bbl</file>
</provides>
<requires type="dynamic">
<file>CT2109-Assignment-03.bcf</file>
</requires>
<requires type="editable">
<file>ecl.bib</file>
</requires>
</external>
</requests>

View File

@ -1,499 +0,0 @@
% $ biblatex auxiliary file $
% $ biblatex bbl format version 3.2 $
% Do not modify the above lines!
%
% This is an auxiliary file used by the 'biblatex' package.
% This file may safely be deleted. It will be recreated by
% biber as required.
%
\begingroup
\makeatletter
\@ifundefined{ver@biblatex.sty}
{\@latex@error
{Missing 'biblatex' package}
{The bibliography requires the 'biblatex' package.}
\aftergroup\endinput}
{}
\endgroup
\refsection{0}
\datalist[entry]{none/global//global/global}
\entry{slides}{online}{}
\name{author}{1}{}{%
{{hash=4db5fdda44d980dfd1fa3c357d9f1fe3}{%
family={Glavin},
familyi={G\bibinitperiod},
given={Frank},
giveni={F\bibinitperiod}}}%
}
\strng{namehash}{4db5fdda44d980dfd1fa3c357d9f1fe3}
\strng{fullhash}{4db5fdda44d980dfd1fa3c357d9f1fe3}
\strng{bibnamehash}{4db5fdda44d980dfd1fa3c357d9f1fe3}
\strng{authorbibnamehash}{4db5fdda44d980dfd1fa3c357d9f1fe3}
\strng{authornamehash}{4db5fdda44d980dfd1fa3c357d9f1fe3}
\strng{authorfullhash}{4db5fdda44d980dfd1fa3c357d9f1fe3}
\field{sortinit}{1}
\field{sortinithash}{4f6aaa89bab872aa0999fec09ff8e98a}
\field{labelnamesource}{author}
\field{labeltitlesource}{title}
\field{addendum}{Uploaded to Blackboard: 2023-02-17}
\field{title}{Topic Three: Algorithm Analysis \& Dynamic Programming Part II}
\keyw{p,np}
\endentry
\entry{wolfram}{online}{}
\name{author}{1}{}{%
{{hash=d041a125476c57c12ca53005c1fe93b1}{%
family={Terr},
familyi={T\bibinitperiod},
given={David},
giveni={D\bibinitperiod}}}%
}
\strng{namehash}{d041a125476c57c12ca53005c1fe93b1}
\strng{fullhash}{d041a125476c57c12ca53005c1fe93b1}
\strng{bibnamehash}{d041a125476c57c12ca53005c1fe93b1}
\strng{authorbibnamehash}{d041a125476c57c12ca53005c1fe93b1}
\strng{authornamehash}{d041a125476c57c12ca53005c1fe93b1}
\strng{authorfullhash}{d041a125476c57c12ca53005c1fe93b1}
\field{sortinit}{2}
\field{sortinithash}{8b555b3791beccb63322c22f3320aa9a}
\field{labelnamesource}{author}
\field{labeltitlesource}{title}
\field{addendum}{(Accessed: 2023-03-03)}
\field{title}{Polynomial Time}
\verb{urlraw}
\verb https://mathworld.wolfram.com/PolynomialTime.html
\endverb
\verb{url}
\verb https://mathworld.wolfram.com/PolynomialTime.html
\endverb
\keyw{p}
\endentry
\entry{floydnondeterm}{online}{}
\name{author}{1}{}{%
{{hash=6a7319445e476f9e3f352261abd48a4a}{%
family={Floyd},
familyi={F\bibinitperiod},
given={Robert\bibnamedelima W.},
giveni={R\bibinitperiod\bibinitdelim W\bibinitperiod}}}%
}
\list{publisher}{1}{%
{Journal of the ACM}%
}
\strng{namehash}{6a7319445e476f9e3f352261abd48a4a}
\strng{fullhash}{6a7319445e476f9e3f352261abd48a4a}
\strng{bibnamehash}{6a7319445e476f9e3f352261abd48a4a}
\strng{authorbibnamehash}{6a7319445e476f9e3f352261abd48a4a}
\strng{authornamehash}{6a7319445e476f9e3f352261abd48a4a}
\strng{authorfullhash}{6a7319445e476f9e3f352261abd48a4a}
\field{sortinit}{3}
\field{sortinithash}{ad6fe7482ffbd7b9f99c9e8b5dccd3d7}
\field{labelnamesource}{author}
\field{labeltitlesource}{title}
\field{month}{10}
\field{title}{Nondeterministic Algorithms}
\field{year}{1967}
\field{dateera}{ce}
\verb{doi}
\verb 10.1145/321420.321422
\endverb
\endentry
\entry{britnpcomp}{online}{}
\name{author}{1}{}{%
{{hash=b5b5d41e9deb4fed9ffa108254d8b7ad}{%
family={Hosch},
familyi={H\bibinitperiod},
given={William\bibnamedelima L.},
giveni={W\bibinitperiod\bibinitdelim L\bibinitperiod}}}%
}
\list{publisher}{1}{%
{Encyclopedia Britannica}%
}
\strng{namehash}{b5b5d41e9deb4fed9ffa108254d8b7ad}
\strng{fullhash}{b5b5d41e9deb4fed9ffa108254d8b7ad}
\strng{bibnamehash}{b5b5d41e9deb4fed9ffa108254d8b7ad}
\strng{authorbibnamehash}{b5b5d41e9deb4fed9ffa108254d8b7ad}
\strng{authornamehash}{b5b5d41e9deb4fed9ffa108254d8b7ad}
\strng{authorfullhash}{b5b5d41e9deb4fed9ffa108254d8b7ad}
\field{extraname}{1}
\field{sortinit}{4}
\field{sortinithash}{9381316451d1b9788675a07e972a12a7}
\field{labelnamesource}{author}
\field{labeltitlesource}{title}
\field{addendum}{(Accessed: 2023-03-03)}
\field{day}{10}
\field{month}{3}
\field{title}{NP-complete problem}
\field{year}{2023}
\field{dateera}{ce}
\verb{urlraw}
\verb https://www.britannica.com/science/NP-complete-problem#ref97458
\endverb
\verb{url}
\verb https://www.britannica.com/science/NP-complete-problem#ref97458
\endverb
\endentry
\entry{fortnow}{online}{}
\name{author}{1}{}{%
{{hash=e43a5724fcae7ec1838dfc44579da075}{%
family={Fortnow},
familyi={F\bibinitperiod},
given={Lance},
giveni={L\bibinitperiod}}}%
}
\list{publisher}{1}{%
{Communications of the ACM}%
}
\strng{namehash}{e43a5724fcae7ec1838dfc44579da075}
\strng{fullhash}{e43a5724fcae7ec1838dfc44579da075}
\strng{bibnamehash}{e43a5724fcae7ec1838dfc44579da075}
\strng{authorbibnamehash}{e43a5724fcae7ec1838dfc44579da075}
\strng{authornamehash}{e43a5724fcae7ec1838dfc44579da075}
\strng{authorfullhash}{e43a5724fcae7ec1838dfc44579da075}
\field{sortinit}{5}
\field{sortinithash}{20e9b4b0b173788c5dace24730f47d8c}
\field{labelnamesource}{author}
\field{labeltitlesource}{title}
\field{title}{The status of the P versus NP problem}
\field{year}{2009}
\field{dateera}{ce}
\verb{doi}
\verb 10.1145/1562164.1562186
\endverb
\endentry
\entry{techopedia}{online}{}
\list{publisher}{1}{%
{techopedia}%
}
\field{sortinit}{6}
\field{sortinithash}{b33bc299efb3c36abec520a4c896a66d}
\field{labeltitlesource}{title}
\field{addendum}{(Accessed: 2023-03-03)}
\field{day}{29}
\field{month}{8}
\field{title}{Non-Deterministic Polynomial Time (NP)}
\field{year}{2019}
\field{dateera}{ce}
\verb{urlraw}
\verb https://www.techopedia.com/definition/21028/non-deterministic-polynomial-time-np
\endverb
\verb{url}
\verb https://www.techopedia.com/definition/21028/non-deterministic-polynomial-time-np
\endverb
\endentry
\entry{britpvsnpproblem}{online}{}
\name{author}{1}{}{%
{{hash=b5b5d41e9deb4fed9ffa108254d8b7ad}{%
family={Hosch},
familyi={H\bibinitperiod},
given={William\bibnamedelima L.},
giveni={W\bibinitperiod\bibinitdelim L\bibinitperiod}}}%
}
\list{publisher}{1}{%
{Encyclopedia Britannica}%
}
\strng{namehash}{b5b5d41e9deb4fed9ffa108254d8b7ad}
\strng{fullhash}{b5b5d41e9deb4fed9ffa108254d8b7ad}
\strng{bibnamehash}{b5b5d41e9deb4fed9ffa108254d8b7ad}
\strng{authorbibnamehash}{b5b5d41e9deb4fed9ffa108254d8b7ad}
\strng{authornamehash}{b5b5d41e9deb4fed9ffa108254d8b7ad}
\strng{authorfullhash}{b5b5d41e9deb4fed9ffa108254d8b7ad}
\field{extraname}{2}
\field{sortinit}{9}
\field{sortinithash}{0a5ebc79d83c96b6579069544c73c7d4}
\field{labelnamesource}{author}
\field{labeltitlesource}{title}
\field{addendum}{(Accessed: 2023-03-03)}
\field{day}{22}
\field{month}{2}
\field{title}{P versus NP problem}
\field{year}{2023}
\field{dateera}{ce}
\verb{urlraw}
\verb https://www.britannica.com/science/P-versus-NP-problem
\endverb
\verb{url}
\verb https://www.britannica.com/science/P-versus-NP-problem
\endverb
\endentry
\entry{salesman}{online}{}
\name{author}{1}{}{%
{{hash=d29e15a1eaae3938b743eb055c894692}{%
family={Carlson},
familyi={C\bibinitperiod},
given={Stephan\bibnamedelima C.},
giveni={S\bibinitperiod\bibinitdelim C\bibinitperiod}}}%
}
\list{publisher}{1}{%
{Encyclopedia Britannica}%
}
\strng{namehash}{d29e15a1eaae3938b743eb055c894692}
\strng{fullhash}{d29e15a1eaae3938b743eb055c894692}
\strng{bibnamehash}{d29e15a1eaae3938b743eb055c894692}
\strng{authorbibnamehash}{d29e15a1eaae3938b743eb055c894692}
\strng{authornamehash}{d29e15a1eaae3938b743eb055c894692}
\strng{authorfullhash}{d29e15a1eaae3938b743eb055c894692}
\field{sortinit}{1}
\field{sortinithash}{4f6aaa89bab872aa0999fec09ff8e98a}
\field{labelnamesource}{author}
\field{labeltitlesource}{title}
\field{addendum}{(Accessed: 2023-03-03)}
\field{day}{5}
\field{month}{2}
\field{title}{Travelling salesman Problem}
\field{year}{2023}
\field{dateera}{ce}
\verb{urlraw}
\verb https://www.britannica.com/science/traveling-salesman-problem
\endverb
\verb{url}
\verb https://www.britannica.com/science/traveling-salesman-problem
\endverb
\endentry
\entry{wolframnphard}{online}{}
\name{author}{1}{}{%
{{hash=819197bfeff32a3f58d49b2a3eb0a580}{%
family={Weisstein},
familyi={W\bibinitperiod},
given={Eric\bibnamedelima W.},
giveni={E\bibinitperiod\bibinitdelim W\bibinitperiod}}}%
}
\list{publisher}{1}{%
{MathWorld = A Wolfram Web Resource}%
}
\strng{namehash}{819197bfeff32a3f58d49b2a3eb0a580}
\strng{fullhash}{819197bfeff32a3f58d49b2a3eb0a580}
\strng{bibnamehash}{819197bfeff32a3f58d49b2a3eb0a580}
\strng{authorbibnamehash}{819197bfeff32a3f58d49b2a3eb0a580}
\strng{authornamehash}{819197bfeff32a3f58d49b2a3eb0a580}
\strng{authorfullhash}{819197bfeff32a3f58d49b2a3eb0a580}
\field{sortinit}{1}
\field{sortinithash}{4f6aaa89bab872aa0999fec09ff8e98a}
\field{labelnamesource}{author}
\field{labeltitlesource}{title}
\field{addendum}{(Accessed: 2023-03-03)}
\field{title}{NP-Hard Problem}
\verb{urlraw}
\verb https://mathworld.wolfram.com/NP-HardProblem.html
\endverb
\verb{url}
\verb https://mathworld.wolfram.com/NP-HardProblem.html
\endverb
\endentry
\entry{interact}{book}{}
\name{author}{1}{}{%
{{hash=d7582c31fe3061838883debf5d237536}{%
family={Johnson},
familyi={J\bibinitperiod},
given={Michael\bibnamedelimb R.\bibnamedelimi Garey\bibnamedelimb \& David\bibnamedelima S.},
giveni={M\bibinitperiod\bibinitdelim R\bibinitperiod\bibinitdelim G\bibinitperiod\bibinitdelim \\bibinitperiod\bibinitdelim D\bibinitperiod\bibinitdelim S\bibinitperiod}}}%
}
\list{publisher}{1}{%
{W.H. Freeman}%
}
\strng{namehash}{d7582c31fe3061838883debf5d237536}
\strng{fullhash}{d7582c31fe3061838883debf5d237536}
\strng{bibnamehash}{d7582c31fe3061838883debf5d237536}
\strng{authorbibnamehash}{d7582c31fe3061838883debf5d237536}
\strng{authornamehash}{d7582c31fe3061838883debf5d237536}
\strng{authorfullhash}{d7582c31fe3061838883debf5d237536}
\field{sortinit}{1}
\field{sortinithash}{4f6aaa89bab872aa0999fec09ff8e98a}
\field{labelnamesource}{author}
\field{labeltitlesource}{title}
\field{isbn}{0-7167-1045-5}
\field{title}{Computers \& Intractability: A Guide to the Theory of NP-Completeness}
\field{year}{1979}
\field{dateera}{ce}
\endentry
\entry{halting}{online}{}
\name{author}{1}{}{%
{{hash=38ba3b8c5a650c291517635c39277196}{%
family={al.},
familyi={a\bibinitperiod},
given={Karleigh\bibnamedelima Moore},
giveni={K\bibinitperiod\bibinitdelim M\bibinitperiod},
prefix={et},
prefixi={e\bibinitperiod}}}%
}
\list{publisher}{1}{%
{Brilliant}%
}
\strng{namehash}{38ba3b8c5a650c291517635c39277196}
\strng{fullhash}{38ba3b8c5a650c291517635c39277196}
\strng{bibnamehash}{38ba3b8c5a650c291517635c39277196}
\strng{authorbibnamehash}{38ba3b8c5a650c291517635c39277196}
\strng{authornamehash}{38ba3b8c5a650c291517635c39277196}
\strng{authorfullhash}{38ba3b8c5a650c291517635c39277196}
\field{sortinit}{1}
\field{sortinithash}{4f6aaa89bab872aa0999fec09ff8e98a}
\field{labelnamesource}{author}
\field{labeltitlesource}{title}
\field{addendum}{(Accessed: 2023-03-03)}
\field{title}{Halting Problem}
\verb{urlraw}
\verb https://brilliant.org/wiki/halting-problem/
\endverb
\verb{url}
\verb https://brilliant.org/wiki/halting-problem/
\endverb
\endentry
\entry{npcompbrit}{online}{}
\name{author}{1}{}{%
{{hash=db058bcb62506fba9fe25e53a62e1e0f}{%
family={Gregersen},
familyi={G\bibinitperiod},
given={Erik},
giveni={E\bibinitperiod}}}%
}
\list{publisher}{1}{%
{Encyclopedia Britannica}%
}
\strng{namehash}{db058bcb62506fba9fe25e53a62e1e0f}
\strng{fullhash}{db058bcb62506fba9fe25e53a62e1e0f}
\strng{bibnamehash}{db058bcb62506fba9fe25e53a62e1e0f}
\strng{authorbibnamehash}{db058bcb62506fba9fe25e53a62e1e0f}
\strng{authornamehash}{db058bcb62506fba9fe25e53a62e1e0f}
\strng{authorfullhash}{db058bcb62506fba9fe25e53a62e1e0f}
\field{sortinit}{1}
\field{sortinithash}{4f6aaa89bab872aa0999fec09ff8e98a}
\field{labelnamesource}{author}
\field{labeltitlesource}{title}
\field{addendum}{(Accessed: 2023-03-12)}
\field{day}{10}
\field{month}{3}
\field{title}{NP-Complete Problem}
\field{year}{2023}
\field{dateera}{ce}
\verb{urlraw}
\verb https://www.britannica.com/science/traveling-salesman-problem
\endverb
\verb{url}
\verb https://www.britannica.com/science/traveling-salesman-problem
\endverb
\endentry
\entry{cook}{online}{}
\name{author}{1}{}{%
{{hash=6d0042ba6060405425561c0184e8ece1}{%
family={Cook},
familyi={C\bibinitperiod},
given={Stephen},
giveni={S\bibinitperiod}}}%
}
\list{publisher}{1}{%
{Proceedings of the Third Annual ACM Symposium on Theory of Computing}%
}
\strng{namehash}{6d0042ba6060405425561c0184e8ece1}
\strng{fullhash}{6d0042ba6060405425561c0184e8ece1}
\strng{bibnamehash}{6d0042ba6060405425561c0184e8ece1}
\strng{authorbibnamehash}{6d0042ba6060405425561c0184e8ece1}
\strng{authornamehash}{6d0042ba6060405425561c0184e8ece1}
\strng{authorfullhash}{6d0042ba6060405425561c0184e8ece1}
\field{sortinit}{1}
\field{sortinithash}{4f6aaa89bab872aa0999fec09ff8e98a}
\field{labelnamesource}{author}
\field{labeltitlesource}{title}
\field{title}{The complexity of theorem-proving procedures}
\field{year}{1971}
\field{dateera}{ce}
\verb{doi}
\verb 10.1145/800157.805047
\endverb
\endentry
\entry{pvsnpbrit}{online}{}
\name{author}{1}{}{%
{{hash=b5b5d41e9deb4fed9ffa108254d8b7ad}{%
family={Hosch},
familyi={H\bibinitperiod},
given={William\bibnamedelima L.},
giveni={W\bibinitperiod\bibinitdelim L\bibinitperiod}}}%
}
\list{publisher}{1}{%
{Encyclopedia Britannica}%
}
\strng{namehash}{b5b5d41e9deb4fed9ffa108254d8b7ad}
\strng{fullhash}{b5b5d41e9deb4fed9ffa108254d8b7ad}
\strng{bibnamehash}{b5b5d41e9deb4fed9ffa108254d8b7ad}
\strng{authorbibnamehash}{b5b5d41e9deb4fed9ffa108254d8b7ad}
\strng{authornamehash}{b5b5d41e9deb4fed9ffa108254d8b7ad}
\strng{authorfullhash}{b5b5d41e9deb4fed9ffa108254d8b7ad}
\field{extraname}{3}
\field{sortinit}{1}
\field{sortinithash}{4f6aaa89bab872aa0999fec09ff8e98a}
\field{labelnamesource}{author}
\field{labeltitlesource}{title}
\field{addendum}{(Accessed: 2023-03-03)}
\field{day}{22}
\field{month}{2}
\field{title}{P versus NP problem}
\field{year}{2023}
\field{dateera}{ce}
\verb{urlraw}
\verb https://www.britannica.com/science/P-versus-NP-problem
\endverb
\verb{url}
\verb https://www.britannica.com/science/P-versus-NP-problem
\endverb
\endentry
\entry{poll}{online}{}
\name{author}{1}{}{%
{{hash=888d7977ce776bc206a593c5821bea9f}{%
family={Gasarch},
familyi={G\bibinitperiod},
given={William\bibnamedelima I.},
giveni={W\bibinitperiod\bibinitdelim I\bibinitperiod}}}%
}
\list{publisher}{1}{%
{SIGACT News}%
}
\strng{namehash}{888d7977ce776bc206a593c5821bea9f}
\strng{fullhash}{888d7977ce776bc206a593c5821bea9f}
\strng{bibnamehash}{888d7977ce776bc206a593c5821bea9f}
\strng{authorbibnamehash}{888d7977ce776bc206a593c5821bea9f}
\strng{authornamehash}{888d7977ce776bc206a593c5821bea9f}
\strng{authorfullhash}{888d7977ce776bc206a593c5821bea9f}
\field{sortinit}{2}
\field{sortinithash}{8b555b3791beccb63322c22f3320aa9a}
\field{labelnamesource}{author}
\field{labeltitlesource}{title}
\field{month}{6}
\field{title}{The P=?NP poll}
\field{year}{2002}
\field{dateera}{ce}
\verb{doi}
\verb 10.1145/564585.564599
\endverb
\endentry
\entry{sipser}{online}{}
\name{author}{1}{}{%
{{hash=13b9c16a9de2bb891eb8aa2a768eb2a8}{%
family={Sipser},
familyi={S\bibinitperiod},
given={Michael},
giveni={M\bibinitperiod}}}%
}
\list{publisher}{1}{%
{Proceedings of the twenty-fourth annual ACM Symposium on Theory of Computing}%
}
\strng{namehash}{13b9c16a9de2bb891eb8aa2a768eb2a8}
\strng{fullhash}{13b9c16a9de2bb891eb8aa2a768eb2a8}
\strng{bibnamehash}{13b9c16a9de2bb891eb8aa2a768eb2a8}
\strng{authorbibnamehash}{13b9c16a9de2bb891eb8aa2a768eb2a8}
\strng{authornamehash}{13b9c16a9de2bb891eb8aa2a768eb2a8}
\strng{authorfullhash}{13b9c16a9de2bb891eb8aa2a768eb2a8}
\field{sortinit}{2}
\field{sortinithash}{8b555b3791beccb63322c22f3320aa9a}
\field{labelnamesource}{author}
\field{labeltitlesource}{title}
\field{month}{7}
\field{title}{The history \& status of the P versus NP question}
\field{year}{1992}
\field{dateera}{ce}
\verb{doi}
\verb 10.1145/129712.129771
\endverb
\endentry
\enddatalist
\endrefsection
\endinput

View File

@ -1,86 +0,0 @@
<?xml version="1.0" standalone="yes"?>
<!-- logreq request file -->
<!-- logreq version 1.0 / dtd version 1.0 -->
<!-- Do not edit this file! -->
<!DOCTYPE requests [
<!ELEMENT requests (internal | external)*>
<!ELEMENT internal (generic, (provides | requires)*)>
<!ELEMENT external (generic, cmdline?, input?, output?, (provides | requires)*)>
<!ELEMENT cmdline (binary, (option | infile | outfile)*)>
<!ELEMENT input (file)+>
<!ELEMENT output (file)+>
<!ELEMENT provides (file)+>
<!ELEMENT requires (file)+>
<!ELEMENT generic (#PCDATA)>
<!ELEMENT binary (#PCDATA)>
<!ELEMENT option (#PCDATA)>
<!ELEMENT infile (#PCDATA)>
<!ELEMENT outfile (#PCDATA)>
<!ELEMENT file (#PCDATA)>
<!ATTLIST requests
version CDATA #REQUIRED
>
<!ATTLIST internal
package CDATA #REQUIRED
priority (9) #REQUIRED
active (0 | 1) #REQUIRED
>
<!ATTLIST external
package CDATA #REQUIRED
priority (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8) #REQUIRED
active (0 | 1) #REQUIRED
>
<!ATTLIST provides
type (static | dynamic | editable) #REQUIRED
>
<!ATTLIST requires
type (static | dynamic | editable) #REQUIRED
>
<!ATTLIST file
type CDATA #IMPLIED
>
]>
<requests version="1.0">
<internal package="biblatex" priority="9" active="0">
<generic>latex</generic>
<provides type="dynamic">
<file>CT2109-Assignment-04.bcf</file>
</provides>
<requires type="dynamic">
<file>CT2109-Assignment-04.bbl</file>
</requires>
<requires type="static">
<file>blx-dm.def</file>
<file>blx-compat.def</file>
<file>biblatex.def</file>
<file>standard.bbx</file>
<file>numeric.bbx</file>
<file>numeric-comp.bbx</file>
<file>numeric-comp.cbx</file>
<file>biblatex.cfg</file>
<file>english.lbx</file>
</requires>
</internal>
<external package="biblatex" priority="5" active="0">
<generic>biber</generic>
<cmdline>
<binary>biber</binary>
<infile>CT2109-Assignment-04</infile>
</cmdline>
<input>
<file>CT2109-Assignment-04.bcf</file>
</input>
<output>
<file>CT2109-Assignment-04.bbl</file>
</output>
<provides type="dynamic">
<file>CT2109-Assignment-04.bbl</file>
</provides>
<requires type="dynamic">
<file>CT2109-Assignment-04.bcf</file>
</requires>
<requires type="editable">
<file>references.bib</file>
</requires>
</external>
</requests>

View File

@ -1,5 +0,0 @@
[0] Config.pm:306> INFO - This is Biber 2.18
[0] Config.pm:309> INFO - Logfile is 'CT2109-Assignment-04.tex.blg'
[47] biber:340> INFO - === Tue Mar 14, 2023, 17:38:31
[138] Utils.pm:410> ERROR - Cannot find 'CT2109-Assignment-04.tex.bcf'!
[138] Biber.pm:135> INFO - ERRORS: 1

View File

@ -1,5 +0,0 @@
[0] Config.pm:306> INFO - This is Biber 2.18
[0] Config.pm:309> INFO - Logfile is 'references.bib.blg'
[47] biber:340> INFO - === Tue Mar 14, 2023, 17:38:23
[129] Utils.pm:410> ERROR - Cannot find 'references.bib.bcf'!
[129] Biber.pm:135> INFO - ERRORS: 1

View File

@ -1,85 +0,0 @@
<?xml version="1.0" standalone="yes"?>
<!-- logreq request file -->
<!-- logreq version 1.0 / dtd version 1.0 -->
<!-- Do not edit this file! -->
<!DOCTYPE requests [
<!ELEMENT requests (internal | external)*>
<!ELEMENT internal (generic, (provides | requires)*)>
<!ELEMENT external (generic, cmdline?, input?, output?, (provides | requires)*)>
<!ELEMENT cmdline (binary, (option | infile | outfile)*)>
<!ELEMENT input (file)+>
<!ELEMENT output (file)+>
<!ELEMENT provides (file)+>
<!ELEMENT requires (file)+>
<!ELEMENT generic (#PCDATA)>
<!ELEMENT binary (#PCDATA)>
<!ELEMENT option (#PCDATA)>
<!ELEMENT infile (#PCDATA)>
<!ELEMENT outfile (#PCDATA)>
<!ELEMENT file (#PCDATA)>
<!ATTLIST requests
version CDATA #REQUIRED
>
<!ATTLIST internal
package CDATA #REQUIRED
priority (9) #REQUIRED
active (0 | 1) #REQUIRED
>
<!ATTLIST external
package CDATA #REQUIRED
priority (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8) #REQUIRED
active (0 | 1) #REQUIRED
>
<!ATTLIST provides
type (static | dynamic | editable) #REQUIRED
>
<!ATTLIST requires
type (static | dynamic | editable) #REQUIRED
>
<!ATTLIST file
type CDATA #IMPLIED
>
]>
<requests version="1.0">
<internal package="biblatex" priority="9" active="0">
<generic>latex</generic>
<provides type="dynamic">
<file>CT2109-Assignment-05.bcf</file>
</provides>
<requires type="dynamic">
<file>CT2109-Assignment-05.bbl</file>
</requires>
<requires type="static">
<file>blx-dm.def</file>
<file>blx-compat.def</file>
<file>biblatex.def</file>
<file>standard.bbx</file>
<file>numeric.bbx</file>
<file>numeric.cbx</file>
<file>biblatex.cfg</file>
<file>english.lbx</file>
</requires>
</internal>
<external package="biblatex" priority="5" active="0">
<generic>biber</generic>
<cmdline>
<binary>biber</binary>
<infile>CT2109-Assignment-05</infile>
</cmdline>
<input>
<file>CT2109-Assignment-05.bcf</file>
</input>
<output>
<file>CT2109-Assignment-05.bbl</file>
</output>
<provides type="dynamic">
<file>CT2109-Assignment-05.bbl</file>
</provides>
<requires type="dynamic">
<file>CT2109-Assignment-05.bcf</file>
</requires>
<requires type="editable">
<file>ecl.bib</file>
</requires>
</external>
</requests>

View File

@ -1,49 +0,0 @@
\relax
\providecommand\hyper@newdestlabel[2]{}
\providecommand\HyperFirstAtBeginDocument{\AtBeginDocument}
\HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined
\global\let\oldnewlabel\newlabel
\gdef\newlabel#1#2{\newlabelxx{#1}#2}
\gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}}
\AtEndDocument{\ifx\hyper@anchor\@undefined
\let\newlabel\oldnewlabel
\fi}
\fi}
\global\let\hyper@last\relax
\gdef\HyperFirstAtBeginDocument#1{#1}
\providecommand\HyField@AuxAddToFields[1]{}
\providecommand\HyField@AuxAddToCoFields[2]{}
\@writefile{toc}{\contentsline {section}{\numberline {1}Abstract Data Types}{2}{section.1}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {1.1}Stacks \& Queues}{2}{subsection.1.1}\protected@file@percent }
\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.1.1}Stacks}{2}{subsubsection.1.1.1}\protected@file@percent }
\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.1.2}Queues}{2}{subsubsection.1.1.2}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {1.2}Linked Lists}{3}{subsection.1.2}\protected@file@percent }
\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.2.1}Implementation of Linked Lists}{3}{subsubsection.1.2.1}\protected@file@percent }
\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.2.2}Singly Linked List Class}{4}{subsubsection.1.2.2}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\numberline {2}Algorithm Analysis}{5}{section.2}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {2.1}Algorithm Analysis Basics}{5}{subsection.2.1}\protected@file@percent }
\@writefile{toc}{\contentsline {subsubsection}{\numberline {2.1.1}Counting Primitive Operations}{5}{subsubsection.2.1.1}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}O Notation}{5}{subsection.2.2}\protected@file@percent }
\@writefile{toc}{\contentsline {subsubsection}{\numberline {2.2.1}Important Functions Used in O Notation}{6}{subsubsection.2.2.1}\protected@file@percent }
\@writefile{toc}{\contentsline {subsubsection}{\numberline {2.2.2}Efficiency \& O Notation}{7}{subsubsection.2.2.2}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {2.3}Recursion Review}{7}{subsection.2.3}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\numberline {3}Dynamic Programming}{7}{section.3}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {3.1}More Big Greek Letters}{8}{subsection.3.1}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {3.2}P, NP, \& NP-Complete Problems}{9}{subsection.3.2}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\numberline {4}Searching \& Sorting}{10}{section.4}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {4.1}Keys \& Values}{10}{subsection.4.1}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {4.2}Java Interface: Comparator}{10}{subsection.4.2}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {4.3}Java Interface: Comparable}{10}{subsection.4.3}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {4.4}Insertion Sort}{10}{subsection.4.4}\protected@file@percent }
\@writefile{loa}{\contentsline {algorithm}{\numberline {1}{\ignorespaces Insertion Sort Pseudocode}}{11}{algorithm.1}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {4.5}Shell Sort}{12}{subsection.4.5}\protected@file@percent }
\@writefile{loa}{\contentsline {algorithm}{\numberline {2}{\ignorespaces Shell Sort Pseudocode}}{12}{algorithm.2}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {4.6}Quick Sort}{12}{subsection.4.6}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\numberline {5}Trees}{13}{section.5}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1}Binary Trees}{13}{subsection.5.1}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {5.2}Generics in Java}{13}{subsection.5.2}\protected@file@percent }
\bibstyle{unsrtnat}
\bibdata{references}
\@writefile{toc}{\contentsline {section}{\numberline {6}Search Trees}{14}{section.6}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1}Binary Search Trees}{14}{subsection.6.1}\protected@file@percent }
\gdef \@abspage@last{15}

View File

@ -1,700 +0,0 @@
This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023) (preloaded format=pdflatex 2023.4.9) 20 APR 2023 20:24
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**CT2109-Notes
(./CT2109-Notes.tex
LaTeX2e <2022-11-01> patch level 1
L3 programming layer <2023-03-30>
(/opt/texlive/2023/texmf-dist/tex/latex/base/article.cls
Document Class: article 2022/07/02 v1.4n Standard LaTeX document class
(/opt/texlive/2023/texmf-dist/tex/latex/base/size11.clo
File: size11.clo 2022/07/02 v1.4n Standard LaTeX file (size option)
)
\c@part=\count185
\c@section=\count186
\c@subsection=\count187
\c@subsubsection=\count188
\c@paragraph=\count189
\c@subparagraph=\count190
\c@figure=\count191
\c@table=\count192
\abovecaptionskip=\skip48
\belowcaptionskip=\skip49
\bibindent=\dimen140
) (./report.sty
(/opt/texlive/2023/texmf-dist/tex/latex/geometry/geometry.sty
Package: geometry 2020/01/02 v5.9 Page Geometry
(/opt/texlive/2023/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 2022/05/29 v1.15 key=value parser (DPC)
\KV@toks@=\toks16
)
(/opt/texlive/2023/texmf-dist/tex/generic/iftex/ifvtex.sty
Package: ifvtex 2019/10/25 v1.7 ifvtex legacy package. Use iftex instead.
(/opt/texlive/2023/texmf-dist/tex/generic/iftex/iftex.sty
Package: iftex 2022/02/03 v1.0f TeX engine tests
))
\Gm@cnth=\count193
\Gm@cntv=\count194
\c@Gm@tempcnt=\count195
\Gm@bindingoffset=\dimen141
\Gm@wd@mp=\dimen142
\Gm@odd@mp=\dimen143
\Gm@even@mp=\dimen144
\Gm@layoutwidth=\dimen145
\Gm@layoutheight=\dimen146
\Gm@layouthoffset=\dimen147
\Gm@layoutvoffset=\dimen148
\Gm@dimlist=\toks17
)
(/opt/texlive/2023/texmf-dist/tex/latex/fancyhdr/fancyhdr.sty
Package: fancyhdr 2022/11/09 v4.1 Extensive control of page headers and footers
\f@nch@headwidth=\skip50
\f@nch@O@elh=\skip51
\f@nch@O@erh=\skip52
\f@nch@O@olh=\skip53
\f@nch@O@orh=\skip54
\f@nch@O@elf=\skip55
\f@nch@O@erf=\skip56
\f@nch@O@olf=\skip57
\f@nch@O@orf=\skip58
)
\@abovecaptionskip=\skip59
\@belowcaptionskip=\skip60
)
(/opt/texlive/2023/texmf-dist/tex/latex/algorithmicx/algpseudocode.sty
Package: algpseudocode
(/opt/texlive/2023/texmf-dist/tex/latex/base/ifthen.sty
Package: ifthen 2022/04/13 v1.1d Standard LaTeX ifthen package (DPC)
)
(/opt/texlive/2023/texmf-dist/tex/latex/algorithmicx/algorithmicx.sty
Package: algorithmicx 2005/04/27 v1.2 Algorithmicx
Document Style algorithmicx 1.2 - a greatly improved `algorithmic' style
\c@ALG@line=\count196
\c@ALG@rem=\count197
\c@ALG@nested=\count198
\ALG@tlm=\skip61
\ALG@thistlm=\skip62
\c@ALG@Lnr=\count199
\c@ALG@blocknr=\count266
\c@ALG@storecount=\count267
\c@ALG@tmpcounter=\count268
\ALG@tmplength=\skip63
)
Document Style - pseudocode environments for use with the `algorithmicx' style
) (/opt/texlive/2023/texmf-dist/tex/latex/algorithms/algorithm.sty
Package: algorithm 2009/08/24 v0.1 Document Style `algorithm' - floating enviro
nment
(/opt/texlive/2023/texmf-dist/tex/latex/float/float.sty
Package: float 2001/11/08 v1.3d Float enhancements (AL)
\c@float@type=\count269
\float@exts=\toks18
\float@box=\box51
\@float@everytoks=\toks19
\@floatcapt=\box52
)
\@float@every@algorithm=\toks20
\c@algorithm=\count270
)
(/opt/texlive/2023/texmf-dist/tex/latex/base/inputenc.sty
Package: inputenc 2021/02/14 v1.3d Input encoding file
\inpenc@prehook=\toks21
\inpenc@posthook=\toks22
)
(/opt/texlive/2023/texmf-dist/tex/latex/base/fontenc.sty
Package: fontenc 2021/04/29 v2.0v Standard LaTeX package
LaTeX Font Info: Trying to load font information for T1+ptm on input line 11
2.
(/opt/texlive/2023/texmf-dist/tex/latex/psnfss/t1ptm.fd
File: t1ptm.fd 2001/06/04 font definitions for T1/ptm.
))
(/opt/texlive/2023/texmf-dist/tex/latex/hyperref/hyperref.sty
Package: hyperref 2023-02-07 v7.00v Hypertext links for LaTeX
(/opt/texlive/2023/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty
Package: ltxcmds 2020-05-10 v1.25 LaTeX kernel commands for general use (HO)
)
(/opt/texlive/2023/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty
Package: pdftexcmds 2020-06-27 v0.33 Utility functions of pdfTeX for LuaTeX (HO
)
(/opt/texlive/2023/texmf-dist/tex/generic/infwarerr/infwarerr.sty
Package: infwarerr 2019/12/03 v1.5 Providing info/warning/error messages (HO)
)
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
Package pdftexcmds Info: \pdfdraftmode found.
)
(/opt/texlive/2023/texmf-dist/tex/latex/kvsetkeys/kvsetkeys.sty
Package: kvsetkeys 2022-10-05 v1.19 Key value parser (HO)
)
(/opt/texlive/2023/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty
Package: kvdefinekeys 2019-12-19 v1.6 Define keys (HO)
)
(/opt/texlive/2023/texmf-dist/tex/generic/pdfescape/pdfescape.sty
Package: pdfescape 2019/12/09 v1.15 Implements pdfTeX's escape features (HO)
)
(/opt/texlive/2023/texmf-dist/tex/latex/hycolor/hycolor.sty
Package: hycolor 2020-01-27 v1.10 Color options for hyperref/bookmark (HO)
)
(/opt/texlive/2023/texmf-dist/tex/latex/letltxmacro/letltxmacro.sty
Package: letltxmacro 2019/12/03 v1.6 Let assignment for LaTeX macros (HO)
)
(/opt/texlive/2023/texmf-dist/tex/latex/auxhook/auxhook.sty
Package: auxhook 2019-12-17 v1.6 Hooks for auxiliary files (HO)
)
(/opt/texlive/2023/texmf-dist/tex/latex/hyperref/nameref.sty
Package: nameref 2022-05-17 v2.50 Cross-referencing by name of section
(/opt/texlive/2023/texmf-dist/tex/latex/refcount/refcount.sty
Package: refcount 2019/12/15 v3.6 Data extraction from label references (HO)
)
(/opt/texlive/2023/texmf-dist/tex/generic/gettitlestring/gettitlestring.sty
Package: gettitlestring 2019/12/15 v1.6 Cleanup title references (HO)
(/opt/texlive/2023/texmf-dist/tex/latex/kvoptions/kvoptions.sty
Package: kvoptions 2022-06-15 v3.15 Key value format for package options (HO)
))
\c@section@level=\count271
)
\@linkdim=\dimen149
\Hy@linkcounter=\count272
\Hy@pagecounter=\count273
(/opt/texlive/2023/texmf-dist/tex/latex/hyperref/pd1enc.def
File: pd1enc.def 2023-02-07 v7.00v Hyperref: PDFDocEncoding definition (HO)
Now handling font encoding PD1 ...
... no UTF-8 mapping file for font encoding PD1
)
(/opt/texlive/2023/texmf-dist/tex/generic/intcalc/intcalc.sty
Package: intcalc 2019/12/15 v1.3 Expandable calculations with integers (HO)
)
(/opt/texlive/2023/texmf-dist/tex/generic/etexcmds/etexcmds.sty
Package: etexcmds 2019/12/15 v1.7 Avoid name clashes with e-TeX commands (HO)
)
\Hy@SavedSpaceFactor=\count274
(/opt/texlive/2023/texmf-dist/tex/latex/hyperref/puenc.def
File: puenc.def 2023-02-07 v7.00v Hyperref: PDF Unicode definition (HO)
Now handling font encoding PU ...
... no UTF-8 mapping file for font encoding PU
)
Package hyperref Info: Option `colorlinks' set `true' on input line 4060.
Package hyperref Info: Hyper figures OFF on input line 4177.
Package hyperref Info: Link nesting OFF on input line 4182.
Package hyperref Info: Hyper index ON on input line 4185.
Package hyperref Info: Plain pages OFF on input line 4192.
Package hyperref Info: Backreferencing OFF on input line 4197.
Package hyperref Info: Implicit mode ON; LaTeX internals redefined.
Package hyperref Info: Bookmarks ON on input line 4425.
\c@Hy@tempcnt=\count275
(/opt/texlive/2023/texmf-dist/tex/latex/url/url.sty
\Urlmuskip=\muskip16
Package: url 2013/09/16 ver 3.4 Verb mode for urls, etc.
)
LaTeX Info: Redefining \url on input line 4763.
\XeTeXLinkMargin=\dimen150
(/opt/texlive/2023/texmf-dist/tex/generic/bitset/bitset.sty
Package: bitset 2019/12/09 v1.3 Handle bit-vector datatype (HO)
(/opt/texlive/2023/texmf-dist/tex/generic/bigintcalc/bigintcalc.sty
Package: bigintcalc 2019/12/15 v1.5 Expandable calculations on big integers (HO
)
))
\Fld@menulength=\count276
\Field@Width=\dimen151
\Fld@charsize=\dimen152
Package hyperref Info: Hyper figures OFF on input line 6042.
Package hyperref Info: Link nesting OFF on input line 6047.
Package hyperref Info: Hyper index ON on input line 6050.
Package hyperref Info: backreferencing OFF on input line 6057.
Package hyperref Info: Link coloring ON on input line 6060.
Package hyperref Info: Link coloring with OCG OFF on input line 6067.
Package hyperref Info: PDF/A mode OFF on input line 6072.
(/opt/texlive/2023/texmf-dist/tex/latex/base/atbegshi-ltx.sty
Package: atbegshi-ltx 2021/01/10 v1.0c Emulation of the original atbegshi
package with kernel methods
)
\Hy@abspage=\count277
\c@Item=\count278
\c@Hfootnote=\count279
)
Package hyperref Info: Driver (autodetected): hpdftex.
(/opt/texlive/2023/texmf-dist/tex/latex/hyperref/hpdftex.def
File: hpdftex.def 2023-02-07 v7.00v Hyperref driver for pdfTeX
(/opt/texlive/2023/texmf-dist/tex/latex/base/atveryend-ltx.sty
Package: atveryend-ltx 2020/08/19 v1.0a Emulation of the original atveryend pac
kage
with kernel methods
)
\Fld@listcount=\count280
\c@bookmark@seq@number=\count281
(/opt/texlive/2023/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty
Package: rerunfilecheck 2022-07-10 v1.10 Rerun checks for auxiliary files (HO)
(/opt/texlive/2023/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty
Package: uniquecounter 2019/12/15 v1.4 Provide unlimited unique counter (HO)
)
Package uniquecounter Info: New unique counter `rerunfilecheck' on input line 2
85.
)
\Hy@SectionHShift=\skip64
)
(/opt/texlive/2023/texmf-dist/tex/latex/booktabs/booktabs.sty
Package: booktabs 2020/01/12 v1.61803398 Publication quality tables
\heavyrulewidth=\dimen153
\lightrulewidth=\dimen154
\cmidrulewidth=\dimen155
\belowrulesep=\dimen156
\belowbottomsep=\dimen157
\aboverulesep=\dimen158
\abovetopsep=\dimen159
\cmidrulesep=\dimen160
\cmidrulekern=\dimen161
\defaultaddspace=\dimen162
\@cmidla=\count282
\@cmidlb=\count283
\@aboverulesep=\dimen163
\@belowrulesep=\dimen164
\@thisruleclass=\count284
\@lastruleclass=\count285
\@thisrulewidth=\dimen165
)
(/opt/texlive/2023/texmf-dist/tex/latex/amsfonts/amsfonts.sty
Package: amsfonts 2013/01/14 v3.01 Basic AMSFonts support
\@emptytoks=\toks23
\symAMSa=\mathgroup4
\symAMSb=\mathgroup5
LaTeX Font Info: Redeclaring math symbol \hbar on input line 98.
LaTeX Font Info: Overwriting math alphabet `\mathfrak' in version `bold'
(Font) U/euf/m/n --> U/euf/b/n on input line 106.
)
(/opt/texlive/2023/texmf-dist/tex/latex/units/nicefrac.sty
Package: nicefrac 1998/08/04 v0.9b Nice fractions
\L@UnitsRaiseDisplaystyle=\skip65
\L@UnitsRaiseTextstyle=\skip66
\L@UnitsRaiseScriptstyle=\skip67
)
(/opt/texlive/2023/texmf-dist/tex/latex/microtype/microtype.sty
Package: microtype 2023/03/13 v3.1a Micro-typographical refinements (RS)
(/opt/texlive/2023/texmf-dist/tex/latex/etoolbox/etoolbox.sty
Package: etoolbox 2020/10/05 v2.5k e-TeX tools for LaTeX (JAW)
\etb@tempcnta=\count286
)
\MT@toks=\toks24
\MT@tempbox=\box53
\MT@count=\count287
LaTeX Info: Redefining \noprotrusionifhmode on input line 1059.
LaTeX Info: Redefining \leftprotrusion on input line 1060.
\MT@prot@toks=\toks25
LaTeX Info: Redefining \rightprotrusion on input line 1078.
LaTeX Info: Redefining \textls on input line 1368.
\MT@outer@kern=\dimen166
LaTeX Info: Redefining \textmicrotypecontext on input line 1988.
\MT@listname@count=\count288
(/opt/texlive/2023/texmf-dist/tex/latex/microtype/microtype-pdftex.def
File: microtype-pdftex.def 2023/03/13 v3.1a Definitions specific to pdftex (RS)
LaTeX Info: Redefining \lsstyle on input line 902.
LaTeX Info: Redefining \lslig on input line 902.
\MT@outer@space=\skip68
)
Package microtype Info: Loading configuration file microtype.cfg.
(/opt/texlive/2023/texmf-dist/tex/latex/microtype/microtype.cfg
File: microtype.cfg 2023/03/13 v3.1a microtype main configuration file (RS)
))
(/opt/texlive/2023/texmf-dist/tex/latex/lipsum/lipsum.sty
(/opt/texlive/2023/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty
(/opt/texlive/2023/texmf-dist/tex/latex/l3kernel/expl3.sty
Package: expl3 2023-03-30 L3 programming layer (loader)
(/opt/texlive/2023/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def
File: l3backend-pdftex.def 2023-03-30 L3 backend support: PDF output (pdfTeX)
\l__color_backend_stack_int=\count289
\l__pdf_internal_box=\box54
))
Package: l3keys2e 2023-02-02 LaTeX2e option processing using LaTeX3 keys
)
Package: lipsum 2021-09-20 v2.7 150 paragraphs of Lorem Ipsum dummy text
\g__lipsum_par_int=\count290
\l__lipsum_a_int=\count291
\l__lipsum_b_int=\count292
(/opt/texlive/2023/texmf-dist/tex/latex/lipsum/lipsum.ltd.tex))
(/opt/texlive/2023/texmf-dist/tex/latex/graphics/graphicx.sty
Package: graphicx 2021/09/16 v1.2d Enhanced LaTeX Graphics (DPC,SPQR)
(/opt/texlive/2023/texmf-dist/tex/latex/graphics/graphics.sty
Package: graphics 2022/03/10 v1.4e Standard LaTeX Graphics (DPC,SPQR)
(/opt/texlive/2023/texmf-dist/tex/latex/graphics/trig.sty
Package: trig 2021/08/11 v1.11 sin cos tan (DPC)
)
(/opt/texlive/2023/texmf-dist/tex/latex/graphics-cfg/graphics.cfg
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
)
Package graphics Info: Driver file: pdftex.def on input line 107.
(/opt/texlive/2023/texmf-dist/tex/latex/graphics-def/pdftex.def
File: pdftex.def 2022/09/22 v1.2b Graphics/color driver for pdftex
))
\Gin@req@height=\dimen167
\Gin@req@width=\dimen168
)
(/opt/texlive/2023/texmf-dist/tex/latex/natbib/natbib.sty
Package: natbib 2010/09/13 8.31b (PWD, AO)
\bibhang=\skip69
\bibsep=\skip70
LaTeX Info: Redefining \cite on input line 694.
\c@NAT@ctr=\count293
)
(/opt/texlive/2023/texmf-dist/tex/latex/doi/doi.sty
Package: doi 2018/09/09 handle doi numbers
)
(/opt/texlive/2023/texmf-dist/tex/latex/tools/array.sty
Package: array 2022/09/04 v2.5g Tabular extension package (FMi)
\col@sep=\dimen169
\ar@mcellbox=\box55
\extrarowheight=\dimen170
\NC@list=\toks26
\extratabsurround=\skip71
\backup@length=\skip72
\ar@cellbox=\box56
)
(/opt/texlive/2023/texmf-dist/tex/latex/listings/listings.sty
\lst@mode=\count294
\lst@gtempboxa=\box57
\lst@token=\toks27
\lst@length=\count295
\lst@currlwidth=\dimen171
\lst@column=\count296
\lst@pos=\count297
\lst@lostspace=\dimen172
\lst@width=\dimen173
\lst@newlines=\count298
\lst@lineno=\count299
\lst@maxwidth=\dimen174
(/opt/texlive/2023/texmf-dist/tex/latex/listings/lstmisc.sty
File: lstmisc.sty 2023/02/27 1.9 (Carsten Heinz)
\c@lstnumber=\count300
\lst@skipnumbers=\count301
\lst@framebox=\box58
)
(/opt/texlive/2023/texmf-dist/tex/latex/listings/listings.cfg
File: listings.cfg 2023/02/27 1.9 listings configuration
))
Package: listings 2023/02/27 1.9 (Carsten Heinz)
(/opt/texlive/2023/texmf-dist/tex/latex/xcolor/xcolor.sty
Package: xcolor 2022/06/12 v2.14 LaTeX color extensions (UK)
(/opt/texlive/2023/texmf-dist/tex/latex/graphics-cfg/color.cfg
File: color.cfg 2016/01/02 v1.6 sample color configuration
)
Package xcolor Info: Driver file: pdftex.def on input line 227.
(/opt/texlive/2023/texmf-dist/tex/latex/graphics/mathcolor.ltx)
Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1353.
Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1357.
Package xcolor Info: Model `RGB' extended on input line 1369.
Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1371.
Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1372.
Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1373.
Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1374.
Package xcolor Info: Model `Gray' substituted by `gray' on input line 1375.
Package xcolor Info: Model `wave' substituted by `hsb' on input line 1376.
)
(./CT2109-Notes.aux)
\openout1 = `CT2109-Notes.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 84.
LaTeX Font Info: ... okay on input line 84.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 84.
LaTeX Font Info: ... okay on input line 84.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 84.
LaTeX Font Info: ... okay on input line 84.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 84.
LaTeX Font Info: ... okay on input line 84.
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 84.
LaTeX Font Info: ... okay on input line 84.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 84.
LaTeX Font Info: ... okay on input line 84.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 84.
LaTeX Font Info: ... okay on input line 84.
LaTeX Font Info: Checking defaults for PD1/pdf/m/n on input line 84.
LaTeX Font Info: ... okay on input line 84.
LaTeX Font Info: Checking defaults for PU/pdf/m/n on input line 84.
LaTeX Font Info: ... okay on input line 84.
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
*geometry* verbose mode - [ preamble ] result:
* driver: pdftex
* paper: letterpaper
* layout: <same size as paper>
* layoutoffset:(h,v)=(0.0pt,0.0pt)
* modes:
* h-part:(L,W,R)=(92.14519pt, 430.00462pt, 92.14519pt)
* v-part:(T,H,B)=(95.39737pt, 556.47656pt, 143.09605pt)
* \paperwidth=614.295pt
* \paperheight=794.96999pt
* \textwidth=430.00462pt
* \textheight=556.47656pt
* \oddsidemargin=19.8752pt
* \evensidemargin=19.8752pt
* \topmargin=-13.87262pt
* \headheight=12.0pt
* \headsep=25.0pt
* \topskip=11.0pt
* \footskip=30.0pt
* \marginparwidth=59.0pt
* \marginparsep=10.0pt
* \columnsep=10.0pt
* \skip\footins=9.0pt plus 4.0pt minus 2.0pt
* \hoffset=0.0pt
* \voffset=0.0pt
* \mag=1000
* \@twocolumnfalse
* \@twosidefalse
* \@mparswitchfalse
* \@reversemarginfalse
* (1in=72.27pt=25.4mm, 1cm=28.453pt)
*geometry* verbose mode - [ newgeometry ] result:
* driver: pdftex
* paper: letterpaper
* layout: <same size as paper>
* layoutoffset:(h,v)=(0.0pt,0.0pt)
* modes:
* h-part:(L,W,R)=(72.27pt, 469.75499pt, 72.27pt)
* v-part:(T,H,B)=(72.26999pt, 650.43pt, 72.27pt)
* \paperwidth=614.295pt
* \paperheight=794.96999pt
* \textwidth=469.75499pt
* \textheight=650.43pt
* \oddsidemargin=0.00002pt
* \evensidemargin=0.00002pt
* \topmargin=-39.0pt
* \headheight=14.0pt
* \headsep=25.0pt
* \topskip=11.0pt
* \footskip=30.0pt
* \marginparwidth=59.0pt
* \marginparsep=10.0pt
* \columnsep=10.0pt
* \skip\footins=9.0pt plus 4.0pt minus 2.0pt
* \hoffset=0.0pt
* \voffset=0.0pt
* \mag=1000
* \@twocolumnfalse
* \@twosidefalse
* \@mparswitchfalse
* \@reversemarginfalse
* (1in=72.27pt=25.4mm, 1cm=28.453pt)
Package hyperref Info: Link coloring ON on input line 84.
(./CT2109-Notes.out) (./CT2109-Notes.out)
\@outlinefile=\write3
\openout3 = `CT2109-Notes.out'.
LaTeX Info: Redefining \microtypecontext on input line 84.
Package microtype Info: Applying patch `item' on input line 84.
Package microtype Info: Applying patch `toc' on input line 84.
Package microtype Info: Applying patch `eqnum' on input line 84.
Package microtype Info: Applying patch `footnote' on input line 84.
Package microtype Info: Applying patch `verbatim' on input line 84.
Package microtype Info: Generating PDF output.
Package microtype Info: Character protrusion enabled (level 2).
Package microtype Info: Using default protrusion set `alltext'.
Package microtype Info: Automatic font expansion enabled (level 2),
(microtype) stretch: 20, shrink: 20, step: 1, non-selected.
Package microtype Info: Using default expansion set `alltext-nott'.
LaTeX Info: Redefining \showhyphens on input line 84.
Package microtype Info: No adjustment of tracking.
Package microtype Info: No adjustment of interword spacing.
Package microtype Info: No adjustment of character kerning.
(/opt/texlive/2023/texmf-dist/tex/latex/microtype/mt-ptm.cfg
File: mt-ptm.cfg 2006/04/20 v1.7 microtype config. file: Times (RS)
)
(/opt/texlive/2023/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count302
\scratchdimen=\dimen175
\scratchbox=\box59
\nofMPsegments=\count303
\nofMParguments=\count304
\everyMPshowfont=\toks28
\MPscratchCnt=\count305
\MPscratchDim=\dimen176
\MPnumerator=\count306
\makeMPintoPDFobject=\count307
\everyMPtoPDFconversion=\toks29
) (/opt/texlive/2023/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty
Package: epstopdf-base 2020-01-24 v2.11 Base part for package epstopdf
Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 4
85.
(/opt/texlive/2023/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv
e
))
\c@lstlisting=\count308
(/opt/texlive/2023/texmf-dist/tex/latex/microtype/mt-cmr.cfg
File: mt-cmr.cfg 2013/05/19 v2.2 microtype config. file: Computer Modern Roman
(RS)
)
LaTeX Font Info: Trying to load font information for U+msa on input line 86.
(/opt/texlive/2023/texmf-dist/tex/latex/amsfonts/umsa.fd
File: umsa.fd 2013/01/14 v3.01 AMS symbols A
)
(/opt/texlive/2023/texmf-dist/tex/latex/microtype/mt-msa.cfg
File: mt-msa.cfg 2006/02/04 v1.1 microtype config. file: AMS symbols (a) (RS)
)
LaTeX Font Info: Trying to load font information for U+msb on input line 86.
(/opt/texlive/2023/texmf-dist/tex/latex/amsfonts/umsb.fd
File: umsb.fd 2013/01/14 v3.01 AMS symbols B
)
(/opt/texlive/2023/texmf-dist/tex/latex/microtype/mt-msb.cfg
File: mt-msb.cfg 2005/06/01 v1.0 microtype config. file: AMS symbols (b) (RS)
) [1
{/opt/texlive/2023/texmf-var/fonts/map/pdftex/updmap/pdftex.map}{/opt/texlive/2
023/texmf-dist/fonts/enc/dvips/base/8r.enc}] (./CT2109-Notes.toc)
\tf@toc=\write4
\openout4 = `CT2109-Notes.toc'.
pdfTeX warning (ext4): destination with the same identifier (name{page.1}) has
been already used, duplicate ignored
<to be read again>
\relax
l.92 \newpage
[1]
<./images//adt.png, id=150, 241.90375pt x 217.81375pt>
File: ./images//adt.png Graphic file (type png)
<use ./images//adt.png>
Package pdftex.def Info: ./images//adt.png used on input line 101.
(pdftex.def) Requested size: 140.92792pt x 126.89705pt.
LaTeX Font Info: Trying to load font information for T1+cmtt on input line 1
18.
(/opt/texlive/2023/texmf-dist/tex/latex/base/t1cmtt.fd
File: t1cmtt.fd 2022/07/10 v2.5l Standard LaTeX font definitions
)
Package microtype Info: Loading generic protrusion settings for font family
(microtype) `cmtt' (encoding: T1).
(microtype) For optimal results, create family-specific settings.
(microtype) See the microtype manual for details.
LaTeX Font Info: Trying to load font information for TS1+ptm on input line 1
20.
(/opt/texlive/2023/texmf-dist/tex/latex/psnfss/ts1ptm.fd
File: ts1ptm.fd 2001/06/04 font definitions for TS1/ptm.
)
(/opt/texlive/2023/texmf-dist/tex/latex/listings/lstlang1.sty
File: lstlang1.sty 2023/02/27 1.9 listings language file
) [2{/opt/texlive/2023/texmf-dist/fonts/enc/dvips/cm-super/cm-super-t1.enc} <./
images//adt.png>]
<./images//ll.png, id=169, 351.3125pt x 64.24pt>
File: ./images//ll.png Graphic file (type png)
<use ./images//ll.png>
Package pdftex.def Info: ./images//ll.png used on input line 171.
(pdftex.def) Requested size: 281.85585pt x 51.54301pt.
<./images//node.png, id=170, 247.92625pt x 97.36375pt>
File: ./images//node.png Graphic file (type png)
<use ./images//node.png>
Package pdftex.def Info: ./images//node.png used on input line 192.
(pdftex.def) Requested size: 140.92792pt x 55.34488pt.
[3 <./images//ll.png> <./images//node.png>] [4] [5]
<./images//comparisonoffunctions1.png, id=244, 1014.79124pt x 577.15625pt>
File: ./images//comparisonoffunctions1.png Graphic file (type png)
<use ./images//comparisonoffunctions1.png>
Package pdftex.def Info: ./images//comparisonoffunctions1.png used on input li
ne 359.
(pdftex.def) Requested size: 375.80542pt x 213.7382pt.
<./images//comparisonoffunctions2.png, id=245, 970.62625pt x 686.565pt>
File: ./images//comparisonoffunctions2.png Graphic file (type png)
<use ./images//comparisonoffunctions2.png>
Package pdftex.def Info: ./images//comparisonoffunctions2.png used on input li
ne 363.
(pdftex.def) Requested size: 375.80542pt x 265.82118pt.
[6 <./images//comparisonoffunctions1.png>] [7 <./images//comparisonoffunctions
2.png>] [8]
<./images//pvsnp.png, id=268, 872.25874pt x 601.24625pt>
File: ./images//pvsnp.png Graphic file (type png)
<use ./images//pvsnp.png>
Package pdftex.def Info: ./images//pvsnp.png used on input line 524.
(pdftex.def) Requested size: 281.85585pt x 194.28345pt.
Underfull \vbox (badness 10000) has occurred while \output is active []
[9]
Package hyperref Info: bookmark level for unknown algorithm defaults to 0 on in
put line 563.
[10 <./images//pvsnp.png>] [11] [12]
<./images//binarytrees.png, id=302, 867.24pt x 393.47pt>
File: ./images//binarytrees.png Graphic file (type png)
<use ./images//binarytrees.png>
Package pdftex.def Info: ./images//binarytrees.png used on input line 690.
(pdftex.def) Requested size: 328.82706pt x 149.18993pt.
[13 <./images//binarytrees.png>]
No file CT2109-Notes.bbl.
[14] (./CT2109-Notes.aux)
Package rerunfilecheck Warning: File `CT2109-Notes.out' has changed.
(rerunfilecheck) Rerun to get outlines right
(rerunfilecheck) or use package `bookmark'.
Package rerunfilecheck Info: Checksums for `CT2109-Notes.out':
(rerunfilecheck) Before: C4445CAE8D3A7CA058755A04227E682D;4176
(rerunfilecheck) After: 213F3292C9B0F0D216A3C578F3C2DCCE;4442.
)
Here is how much of TeX's memory you used:
15981 strings out of 476017
251125 string characters out of 5792769
2074666 words of memory out of 5000000
35747 multiletter control sequences out of 15000+600000
577296 words of font info for 260 fonts, out of 8000000 for 9000
1141 hyphenation exceptions out of 8191
75i,13n,77p,1005b,1985s stack positions out of 10000i,1000n,20000p,200000b,200000s
</opt/texlive/2023/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi10.pfb></opt
/texlive/2023/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi8.pfb></opt/texlive
/2023/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></opt/texlive/2023/te
xmf-dist/fonts/type1/public/amsfonts/cm/cmr8.pfb></opt/texlive/2023/texmf-dist/
fonts/type1/public/amsfonts/cm/cmsy10.pfb></opt/texlive/2023/texmf-dist/fonts/t
ype1/public/cm-super/sftt0900.pfb></opt/texlive/2023/texmf-dist/fonts/type1/pub
lic/cm-super/sftt1095.pfb></opt/texlive/2023/texmf-dist/fonts/type1/urw/times/u
tmb8a.pfb></opt/texlive/2023/texmf-dist/fonts/type1/urw/times/utmr8a.pfb></opt/
texlive/2023/texmf-dist/fonts/type1/urw/times/utmri8a.pfb>
Output written on CT2109-Notes.pdf (15 pages, 1083233 bytes).
PDF statistics:
413 PDF objects out of 1000 (max. 8388607)
358 compressed objects within 4 object streams
148 named destinations out of 1000 (max. 500000)
60156 words of extra memory for PDF output out of 61914 (max. 10000000)

View File

@ -1,29 +0,0 @@
\BOOKMARK [1][-]{section.1}{\376\377\000A\000b\000s\000t\000r\000a\000c\000t\000\040\000D\000a\000t\000a\000\040\000T\000y\000p\000e\000s}{}% 1
\BOOKMARK [2][-]{subsection.1.1}{\376\377\000S\000t\000a\000c\000k\000s\000\040\000\046\000\040\000Q\000u\000e\000u\000e\000s}{section.1}% 2
\BOOKMARK [3][-]{subsubsection.1.1.1}{\376\377\000S\000t\000a\000c\000k\000s}{subsection.1.1}% 3
\BOOKMARK [3][-]{subsubsection.1.1.2}{\376\377\000Q\000u\000e\000u\000e\000s}{subsection.1.1}% 4
\BOOKMARK [2][-]{subsection.1.2}{\376\377\000L\000i\000n\000k\000e\000d\000\040\000L\000i\000s\000t\000s}{section.1}% 5
\BOOKMARK [3][-]{subsubsection.1.2.1}{\376\377\000I\000m\000p\000l\000e\000m\000e\000n\000t\000a\000t\000i\000o\000n\000\040\000o\000f\000\040\000L\000i\000n\000k\000e\000d\000\040\000L\000i\000s\000t\000s}{subsection.1.2}% 6
\BOOKMARK [3][-]{subsubsection.1.2.2}{\376\377\000S\000i\000n\000g\000l\000y\000\040\000L\000i\000n\000k\000e\000d\000\040\000L\000i\000s\000t\000\040\000C\000l\000a\000s\000s}{subsection.1.2}% 7
\BOOKMARK [1][-]{section.2}{\376\377\000A\000l\000g\000o\000r\000i\000t\000h\000m\000\040\000A\000n\000a\000l\000y\000s\000i\000s}{}% 8
\BOOKMARK [2][-]{subsection.2.1}{\376\377\000A\000l\000g\000o\000r\000i\000t\000h\000m\000\040\000A\000n\000a\000l\000y\000s\000i\000s\000\040\000B\000a\000s\000i\000c\000s}{section.2}% 9
\BOOKMARK [3][-]{subsubsection.2.1.1}{\376\377\000C\000o\000u\000n\000t\000i\000n\000g\000\040\000P\000r\000i\000m\000i\000t\000i\000v\000e\000\040\000O\000p\000e\000r\000a\000t\000i\000o\000n\000s}{subsection.2.1}% 10
\BOOKMARK [2][-]{subsection.2.2}{\376\377\000O\000\040\000N\000o\000t\000a\000t\000i\000o\000n}{section.2}% 11
\BOOKMARK [3][-]{subsubsection.2.2.1}{\376\377\000I\000m\000p\000o\000r\000t\000a\000n\000t\000\040\000F\000u\000n\000c\000t\000i\000o\000n\000s\000\040\000U\000s\000e\000d\000\040\000i\000n\000\040\000O\000\040\000N\000o\000t\000a\000t\000i\000o\000n}{subsection.2.2}% 12
\BOOKMARK [3][-]{subsubsection.2.2.2}{\376\377\000E\000f\000f\000i\000c\000i\000e\000n\000c\000y\000\040\000\046\000\040\000O\000\040\000N\000o\000t\000a\000t\000i\000o\000n}{subsection.2.2}% 13
\BOOKMARK [2][-]{subsection.2.3}{\376\377\000R\000e\000c\000u\000r\000s\000i\000o\000n\000\040\000R\000e\000v\000i\000e\000w}{section.2}% 14
\BOOKMARK [1][-]{section.3}{\376\377\000D\000y\000n\000a\000m\000i\000c\000\040\000P\000r\000o\000g\000r\000a\000m\000m\000i\000n\000g}{}% 15
\BOOKMARK [2][-]{subsection.3.1}{\376\377\000M\000o\000r\000e\000\040\000B\000i\000g\000\040\000G\000r\000e\000e\000k\000\040\000L\000e\000t\000t\000e\000r\000s}{section.3}% 16
\BOOKMARK [2][-]{subsection.3.2}{\376\377\000P\000,\000\040\000N\000P\000,\000\040\000\046\000\040\000N\000P\000-\000C\000o\000m\000p\000l\000e\000t\000e\000\040\000P\000r\000o\000b\000l\000e\000m\000s}{section.3}% 17
\BOOKMARK [1][-]{section.4}{\376\377\000S\000e\000a\000r\000c\000h\000i\000n\000g\000\040\000\046\000\040\000S\000o\000r\000t\000i\000n\000g}{}% 18
\BOOKMARK [2][-]{subsection.4.1}{\376\377\000K\000e\000y\000s\000\040\000\046\000\040\000V\000a\000l\000u\000e\000s}{section.4}% 19
\BOOKMARK [2][-]{subsection.4.2}{\376\377\000J\000a\000v\000a\000\040\000I\000n\000t\000e\000r\000f\000a\000c\000e\000:\000\040\000C\000o\000m\000p\000a\000r\000a\000t\000o\000r}{section.4}% 20
\BOOKMARK [2][-]{subsection.4.3}{\376\377\000J\000a\000v\000a\000\040\000I\000n\000t\000e\000r\000f\000a\000c\000e\000:\000\040\000C\000o\000m\000p\000a\000r\000a\000b\000l\000e}{section.4}% 21
\BOOKMARK [2][-]{subsection.4.4}{\376\377\000I\000n\000s\000e\000r\000t\000i\000o\000n\000\040\000S\000o\000r\000t}{section.4}% 22
\BOOKMARK [2][-]{subsection.4.5}{\376\377\000S\000h\000e\000l\000l\000\040\000S\000o\000r\000t}{section.4}% 23
\BOOKMARK [2][-]{subsection.4.6}{\376\377\000Q\000u\000i\000c\000k\000\040\000S\000o\000r\000t}{section.4}% 24
\BOOKMARK [1][-]{section.5}{\376\377\000T\000r\000e\000e\000s}{}% 25
\BOOKMARK [2][-]{subsection.5.1}{\376\377\000B\000i\000n\000a\000r\000y\000\040\000T\000r\000e\000e\000s}{section.5}% 26
\BOOKMARK [2][-]{subsection.5.2}{\376\377\000G\000e\000n\000e\000r\000i\000c\000s\000\040\000i\000n\000\040\000J\000a\000v\000a}{section.5}% 27
\BOOKMARK [1][-]{section.6}{\376\377\000S\000e\000a\000r\000c\000h\000\040\000T\000r\000e\000e\000s}{}% 28
\BOOKMARK [2][-]{subsection.6.1}{\376\377\000B\000i\000n\000a\000r\000y\000\040\000S\000e\000a\000r\000c\000h\000\040\000T\000r\000e\000e\000s}{section.6}% 29

View File

@ -1,29 +0,0 @@
\contentsline {section}{\numberline {1}Abstract Data Types}{2}{section.1}%
\contentsline {subsection}{\numberline {1.1}Stacks \& Queues}{2}{subsection.1.1}%
\contentsline {subsubsection}{\numberline {1.1.1}Stacks}{2}{subsubsection.1.1.1}%
\contentsline {subsubsection}{\numberline {1.1.2}Queues}{2}{subsubsection.1.1.2}%
\contentsline {subsection}{\numberline {1.2}Linked Lists}{3}{subsection.1.2}%
\contentsline {subsubsection}{\numberline {1.2.1}Implementation of Linked Lists}{3}{subsubsection.1.2.1}%
\contentsline {subsubsection}{\numberline {1.2.2}Singly Linked List Class}{4}{subsubsection.1.2.2}%
\contentsline {section}{\numberline {2}Algorithm Analysis}{5}{section.2}%
\contentsline {subsection}{\numberline {2.1}Algorithm Analysis Basics}{5}{subsection.2.1}%
\contentsline {subsubsection}{\numberline {2.1.1}Counting Primitive Operations}{5}{subsubsection.2.1.1}%
\contentsline {subsection}{\numberline {2.2}O Notation}{5}{subsection.2.2}%
\contentsline {subsubsection}{\numberline {2.2.1}Important Functions Used in O Notation}{6}{subsubsection.2.2.1}%
\contentsline {subsubsection}{\numberline {2.2.2}Efficiency \& O Notation}{7}{subsubsection.2.2.2}%
\contentsline {subsection}{\numberline {2.3}Recursion Review}{7}{subsection.2.3}%
\contentsline {section}{\numberline {3}Dynamic Programming}{7}{section.3}%
\contentsline {subsection}{\numberline {3.1}More Big Greek Letters}{8}{subsection.3.1}%
\contentsline {subsection}{\numberline {3.2}P, NP, \& NP-Complete Problems}{9}{subsection.3.2}%
\contentsline {section}{\numberline {4}Searching \& Sorting}{10}{section.4}%
\contentsline {subsection}{\numberline {4.1}Keys \& Values}{10}{subsection.4.1}%
\contentsline {subsection}{\numberline {4.2}Java Interface: Comparator}{10}{subsection.4.2}%
\contentsline {subsection}{\numberline {4.3}Java Interface: Comparable}{10}{subsection.4.3}%
\contentsline {subsection}{\numberline {4.4}Insertion Sort}{10}{subsection.4.4}%
\contentsline {subsection}{\numberline {4.5}Shell Sort}{12}{subsection.4.5}%
\contentsline {subsection}{\numberline {4.6}Quick Sort}{12}{subsection.4.6}%
\contentsline {section}{\numberline {5}Trees}{13}{section.5}%
\contentsline {subsection}{\numberline {5.1}Binary Trees}{13}{subsection.5.1}%
\contentsline {subsection}{\numberline {5.2}Generics in Java}{13}{subsection.5.2}%
\contentsline {section}{\numberline {6}Search Trees}{14}{section.6}%
\contentsline {subsection}{\numberline {6.1}Binary Search Trees}{14}{subsection.6.1}%

View File

@ -1,3 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n+nf}{compareTo}\PYG{p}{(}\PYG{n}{String}\PYG{+w}{ }\PYG{n}{anotherString}\PYG{p}{)}
\end{Verbatim}

View File

@ -1,5 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{interface} \PYG{n+nc}{Runnable}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{run}\PYG{p}{();}
\PYG{p}{\PYGZcb{}}
\end{Verbatim}

View File

@ -1,6 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{n}{ptivate}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{writeObject}\PYG{p}{(}\PYG{n}{ObjectOutputStream}\PYG{+w}{ }\PYG{n}{s}\PYG{p}{)}\PYG{+w}{ }\PYG{k+kd}{throws}\PYG{+w}{ }\PYG{n}{IOException}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{s}\PYG{p}{.}\PYG{n+na}{defaultWriteObject}\PYG{p}{();}
\PYG{+w}{ }\PYG{c+c1}{// customised serialization code}
\PYG{p}{\PYGZcb{}}
\end{Verbatim}

View File

@ -1,7 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{k+kn}{package}\PYG{+w}{ }\PYG{n+nn}{java.io}\PYG{p}{;}
\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{interface} \PYG{n+nc}{Serializable}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// there's nothing in here!}
\PYG{p}{\PYGZcb{};}
\end{Verbatim}

View File

@ -1,8 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{n}{String}\PYG{+w}{ }\PYG{n}{myString}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}Hello world!\PYGZdq{}}\PYG{p}{;}
\PYG{n}{String}\PYG{+w}{ }\PYG{n}{myString}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{String}\PYG{p}{();}
\PYG{k+kt}{char}\PYG{+w}{ }\PYG{o}{[]}\PYG{+w}{ }\PYG{n}{ct326Array}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{p}{\PYGZob{}}\PYG{+w}{ }\PYG{err}{}\PYG{n}{C}\PYG{err}{\PYGZsq{}}\PYG{p}{,}\PYG{+w}{ }\PYG{err}{}\PYG{n}{T}\PYG{err}{\PYGZsq{}}\PYG{p}{,}\PYG{+w}{ }\PYG{err}{}\PYG{l+m+mi}{3}\PYG{err}{\PYGZsq{}}\PYG{p}{,}\PYG{+w}{ }\PYG{err}{}\PYG{l+m+mi}{2}\PYG{err}{\PYGZsq{}}\PYG{p}{,}\PYG{+w}{ }\PYG{err}{}\PYG{l+m+mi}{6}\PYG{err}{\PYGZsq{}}\PYG{+w}{ }\PYG{p}{\PYGZcb{};}
\PYG{n}{String}\PYG{+w}{ }\PYG{n}{ct326String}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{String}\PYG{p}{(}\PYG{n}{ct326Array}\PYG{p}{);}
\PYG{n}{String}\PYG{+w}{ }\PYG{n}{fs}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{tring}\PYG{p}{.}\PYG{n+na}{format}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}The value of the float variable is \PYGZpc{}f, while the value of the integer variable is \PYGZpc{}d, and the string is \PYGZpc{}s\PYGZdq{}}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{floatVar}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{intVar}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{stringVar}\PYG{p}{);}
\end{Verbatim}

View File

@ -1,3 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{run}\PYG{p}{()}
\end{Verbatim}

View File

@ -1,8 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{k+kd}{class} \PYG{n+nc}{EnclosingClass}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{p}{...}
\PYG{+w}{ }\PYG{k+kd}{class} \PYG{n+nc}{ANestedClass}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{p}{...}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{p}{\PYGZcb{}}
\end{Verbatim}

View File

@ -1,12 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYGZdl{} java Planet 175
Your weight on MERCURY is 66.107583
Your weight on VENUS is 158.374842
Your weight on EARTH is 175.000000
Your weight on MARS is 66.279007
Your weight on JUPITER is 442.847567
Your weight on SATURN is 186.552719
Your weight on URANUS is 158.397260
Your weight on NEPTUNE is 199.207413
Your weight on PLUTO is 11.703031
\end{Verbatim}

View File

@ -1,7 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{k+kd}{private}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{readObject}\PYG{p}{(}\PYG{n}{ObjectInputStream}\PYG{+w}{ }\PYG{n}{s}\PYG{p}{)}\PYG{+w}{ }\PYG{k+kd}{throws}\PYG{+w}{ }\PYG{n}{IOException}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{s}\PYG{p}{.}\PYG{n+na}{defaultReadObject}\PYG{p}{();}
\PYG{+w}{ }\PYG{c+c1}{// customised deserialization code}
\PYG{+w}{ }\PYG{c+c1}{// followed by code to update the object if necessary}
\PYG{p}{\PYGZcb{}}
\end{Verbatim}

View File

@ -1,3 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{String}\PYG{+w}{ }\PYG{n+nf}{concat}\PYG{p}{(}\PYG{n}{String}\PYG{+w}{ }\PYG{n}{str}\PYG{p}{)}
\end{Verbatim}

View File

@ -1,9 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{static}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{main}\PYG{p}{(}\PYG{n}{String}\PYG{o}{[]}\PYG{+w}{ }\PYG{n}{args}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{k+kt}{double}\PYG{+w}{ }\PYG{n}{earthWeight}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{Double}\PYG{p}{.}\PYG{n+na}{parseDouble}\PYG{p}{(}\PYG{n}{args}\PYG{o}{[}\PYG{l+m+mi}{0}\PYG{o}{]}\PYG{p}{);}
\PYG{+w}{ }\PYG{k+kt}{double}\PYG{+w}{ }\PYG{n}{mass}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{earthWeight}\PYG{o}{/}\PYG{n}{EARTH}\PYG{p}{.}\PYG{n+na}{surfaceGravity}\PYG{p}{();}
\PYG{+w}{ }\PYG{k}{for}\PYG{+w}{ }\PYG{p}{(}\PYG{n}{Planet}\PYG{+w}{ }\PYG{n}{p}\PYG{+w}{ }\PYG{p}{:}\PYG{+w}{ }\PYG{n}{Planet}\PYG{p}{.}\PYG{n+na}{values}\PYG{p}{())}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{System}\PYG{p}{.}\PYG{n+na}{out}\PYG{p}{.}\PYG{n+na}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Your weight on \PYGZpc{}s is \PYGZpc{}f\PYGZpc{}n\PYGZdq{}}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{p}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{p}\PYG{p}{.}\PYG{n+na}{surfaceWeight}\PYG{p}{(}\PYG{n}{mass}\PYG{p}{));}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\end{Verbatim}

View File

@ -1,3 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{n}{elements}\PYG{p}{.}\PYG{n+na}{forEach}\PYG{p}{(}\PYG{n}{e}\PYG{+w}{ }\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{+w}{ }\PYG{n}{System}\PYG{p}{.}\PYG{n+na}{out}\PYG{p}{.}\PYG{n+na}{println}\PYG{p}{(}\PYG{n}{e}\PYG{p}{));}
\end{Verbatim}

View File

@ -1,14 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{n}{ArrayList}\PYG{o}{\PYGZlt{}}\PYG{n}{Integer}\PYG{o}{\PYGZgt{}}\PYG{+w}{ }\PYG{n}{list}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{ArrayList}\PYG{o}{\PYGZlt{}}\PYG{n}{Integer}\PYG{o}{\PYGZgt{}}\PYG{p}{();}
\PYG{c+c1}{// looping though an ArrayList using the Iterator class}
\PYG{k}{for}\PYG{+w}{ }\PYG{p}{(}\PYG{n}{Iterator}\PYG{+w}{ }\PYG{n}{i}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{.}\PYG{n+na}{iterator}\PYG{p}{();}\PYG{+w}{ }\PYG{n}{i}\PYG{p}{.}\PYG{n+na}{hasNext}\PYG{p}{();)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{Integer}\PYG{+w}{ }\PYG{n}{value}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{p}{(}\PYG{n}{Integer}\PYG{p}{)}\PYG{+w}{ }\PYG{n}{i}\PYG{p}{.}\PYG{n+na}{next}\PYG{p}{();}
\PYG{+w}{ }\PYG{c+c1}{// do some stuff}
\PYG{p}{\PYGZcb{}}
\PYG{c+c1}{// looping though an ArrayList using a For-Each loop}
\PYG{k}{for}\PYG{+w}{ }\PYG{p}{(}\PYG{n}{Integer}\PYG{+w}{ }\PYG{n}{i}\PYG{+w}{ }\PYG{p}{:}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// do some stuff}
\PYG{p}{\PYGZcb{}}
\end{Verbatim}

View File

@ -1,13 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{k+kd}{class} \PYG{n+nc}{Fred}\PYG{+w}{ }\PYG{k+kd}{implements}\PYG{+w}{ }\PYG{n}{Runnable}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{run}\PYG{p}{()}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// insert code to be ran here}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{static}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{main}\PYG{p}{(}\PYG{n}{String}\PYG{+w}{ }\PYG{n}{args}\PYG{o}{[]}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{Thread}\PYG{+w}{ }\PYG{n}{t}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{Thread}\PYG{p}{(}\PYG{k}{new}\PYG{+w}{ }\PYG{n}{Fred}\PYG{p}{())}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{t}\PYG{p}{.}\PYG{n+na}{start}\PYG{p}{();}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{p}{\PYGZcb{}}
\end{Verbatim}

View File

@ -1,3 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{Runtime}
\end{Verbatim}

View File

@ -1,3 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{String}\PYG{+w}{ }\PYG{n+nf}{substring}\PYG{p}{(}\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n}{beginIndex}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n}{endIndex}\PYG{p}{)}
\end{Verbatim}

View File

@ -1,3 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{k+kd}{implements}\PYG{+w}{ }\PYG{n}{Serializable}
\end{Verbatim}

View File

@ -1,3 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{k+kd}{synchronized}
\end{Verbatim}

View File

@ -1,22 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{interface} \PYG{n+nc}{Collection}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// Basic Operations}
\PYG{+w}{ }\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n+nf}{size}\PYG{p}{();}
\PYG{+w}{ }\PYG{k+kt}{boolean}\PYG{+w}{ }\PYG{n+nf}{isEmpty}\PYG{p}{();}
\PYG{+w}{ }\PYG{k+kt}{boolean}\PYG{+w}{ }\PYG{n+nf}{contains}\PYG{p}{(}\PYG{n}{Object}\PYG{+w}{ }\PYG{n}{element}\PYG{p}{);}
\PYG{+w}{ }\PYG{k+kt}{boolean}\PYG{+w}{ }\PYG{n+nf}{add}\PYG{p}{(}\PYG{n}{Object}\PYG{+w}{ }\PYG{n}{element}\PYG{p}{);}\PYG{+w}{ }\PYG{c+c1}{// Optional}
\PYG{+w}{ }\PYG{k+kt}{boolean}\PYG{+w}{ }\PYG{n+nf}{remove}\PYG{p}{(}\PYG{n}{Object}\PYG{+w}{ }\PYG{n}{element}\PYG{p}{);}\PYG{+w}{ }\PYG{c+c1}{// Optional}
\PYG{+w}{ }\PYG{n}{Iterator}\PYG{+w}{ }\PYG{n+nf}{iterator}\PYG{p}{();}
\PYG{+w}{ }\PYG{c+c1}{// Bulk Operations}
\PYG{+w}{ }\PYG{k+kt}{boolean}\PYG{+w}{ }\PYG{n+nf}{containsAll}\PYG{p}{(}\PYG{n}{Collection}\PYG{+w}{ }\PYG{n}{c}\PYG{p}{);}
\PYG{+w}{ }\PYG{k+kt}{boolean}\PYG{+w}{ }\PYG{n+nf}{addAll}\PYG{p}{(}\PYG{n}{Collection}\PYG{+w}{ }\PYG{n}{c}\PYG{p}{);}\PYG{+w}{ }\PYG{c+c1}{// Optional}
\PYG{+w}{ }\PYG{k+kt}{boolean}\PYG{+w}{ }\PYG{n+nf}{removeAll}\PYG{p}{(}\PYG{n}{Collection}\PYG{+w}{ }\PYG{n}{c}\PYG{p}{);}\PYG{+w}{ }\PYG{c+c1}{// Optional}
\PYG{+w}{ }\PYG{k+kt}{boolean}\PYG{+w}{ }\PYG{n+nf}{retainAll}\PYG{p}{(}\PYG{n}{Collection}\PYG{+w}{ }\PYG{n}{c}\PYG{p}{);}\PYG{+w}{ }\PYG{c+c1}{// Optional}
\PYG{+w}{ }\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{clear}\PYG{p}{();}\PYG{+w}{ }\PYG{c+c1}{// Optional}
\PYG{+w}{ }\PYG{c+c1}{// Array Operations}
\PYG{+w}{ }\PYG{n}{Object}\PYG{o}{[]}\PYG{+w}{ }\PYG{n+nf}{toArray}\PYG{p}{();}
\PYG{+w}{ }\PYG{n}{Object}\PYG{o}{[]}\PYG{+w}{ }\PYG{n+nf}{toArray}\PYG{p}{(}\PYG{n}{T}\PYG{o}{[]}\PYG{+w}{ }\PYG{n}{a}\PYG{p}{);}
\PYG{p}{\PYGZcb{}}
\end{Verbatim}

View File

@ -1,3 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{start}\PYG{p}{()}
\end{Verbatim}

View File

@ -1,3 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{k}{new}\PYG{+w}{ }\PYG{n}{RandomAccessFile}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}farrago.txt\PYGZdq{}}\PYG{p}{,}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}r\PYGZdq{}}\PYG{p}{);}
\end{Verbatim}

View File

@ -1,3 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{main}\PYG{p}{()}
\end{Verbatim}

View File

@ -1,33 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{enum}\PYG{+w}{ }\PYG{n}{Planet}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{MERCURY}\PYG{+w}{ }\PYG{p}{(}\PYG{l+m+mf}{3.303e+23}\PYG{p}{,}\PYG{+w}{ }\PYG{l+m+mf}{2.4397e6}\PYG{p}{),}
\PYG{+w}{ }\PYG{n}{VENUS}\PYG{+w}{ }\PYG{p}{(}\PYG{l+m+mf}{4.869e+24}\PYG{p}{,}\PYG{+w}{ }\PYG{l+m+mf}{6.0518e6}\PYG{p}{),}
\PYG{+w}{ }\PYG{n}{EARTH}\PYG{+w}{ }\PYG{p}{(}\PYG{l+m+mf}{5.976e+24}\PYG{p}{,}\PYG{+w}{ }\PYG{l+m+mf}{6.37814e6}\PYG{p}{),}
\PYG{+w}{ }\PYG{n}{MARS}\PYG{+w}{ }\PYG{p}{(}\PYG{l+m+mf}{6.421e+23}\PYG{p}{,}\PYG{+w}{ }\PYG{l+m+mf}{3.3972e6}\PYG{p}{),}
\PYG{+w}{ }\PYG{n}{JUPITER}\PYG{+w}{ }\PYG{p}{(}\PYG{l+m+mf}{1.9e+27}\PYG{p}{,}\PYG{+w}{ }\PYG{l+m+mf}{7.1492e7}\PYG{p}{),}
\PYG{+w}{ }\PYG{n}{SATURN}\PYG{+w}{ }\PYG{p}{(}\PYG{l+m+mf}{5.688e+26}\PYG{p}{,}\PYG{+w}{ }\PYG{l+m+mf}{6.0268e7}\PYG{p}{),}
\PYG{+w}{ }\PYG{n}{URANUS}\PYG{+w}{ }\PYG{p}{(}\PYG{l+m+mf}{8.686e+25}\PYG{p}{,}\PYG{+w}{ }\PYG{l+m+mf}{2.5559e7}\PYG{p}{),}
\PYG{+w}{ }\PYG{n}{NEPTUNE}\PYG{+w}{ }\PYG{p}{(}\PYG{l+m+mf}{1.024e+26}\PYG{p}{,}\PYG{+w}{ }\PYG{l+m+mf}{2.4746e7}\PYG{p}{),}
\PYG{+w}{ }\PYG{n}{PLUTO}\PYG{+w}{ }\PYG{p}{(}\PYG{l+m+mf}{1.27e+22}\PYG{p}{,}\PYG{+w}{ }\PYG{l+m+mf}{1.137e6}\PYG{p}{);}
\PYG{+w}{ }\PYG{k+kd}{private}\PYG{+w}{ }\PYG{k+kd}{final}\PYG{+w}{ }\PYG{k+kt}{double}\PYG{+w}{ }\PYG{n}{mass}\PYG{p}{;}\PYG{+w}{ }\PYG{c+c1}{//in kilograms}
\PYG{+w}{ }\PYG{k+kd}{private}\PYG{+w}{ }\PYG{k+kd}{final}\PYG{+w}{ }\PYG{k+kt}{double}\PYG{+w}{ }\PYG{n}{radius}\PYG{p}{;}\PYG{+w}{ }\PYG{c+c1}{//in meters}
\PYG{+w}{ }\PYG{n}{Planet}\PYG{p}{(}\PYG{k+kt}{double}\PYG{+w}{ }\PYG{n}{mass}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{double}\PYG{+w}{ }\PYG{n}{radius}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{k}{this}\PYG{p}{.}\PYG{n+na}{mass}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{mass}\PYG{p}{;}
\PYG{+w}{ }\PYG{k}{this}\PYG{p}{.}\PYG{n+na}{radius}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{radius}\PYG{p}{;}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kt}{double}\PYG{+w}{ }\PYG{n+nf}{mass}\PYG{p}{()}\PYG{+w}{ }\PYG{p}{\PYGZob{}}\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{n}{mass}\PYG{p}{;}\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kt}{double}\PYG{+w}{ }\PYG{n+nf}{radius}\PYG{p}{()}\PYG{+w}{ }\PYG{p}{\PYGZob{}}\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{n}{radius}\PYG{p}{;}\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{static}\PYG{+w}{ }\PYG{k+kd}{final}\PYG{+w}{ }\PYG{k+kt}{double}\PYG{+w}{ }\PYG{n}{G}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{l+m+mf}{6.67300E\PYGZhy{}11}\PYG{p}{;}\PYG{+w}{ }\PYG{c+c1}{//universal gravitational constant (m3 kg-1 s-2)}
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kt}{double}\PYG{+w}{ }\PYG{n+nf}{surfaceGravity}\PYG{p}{()}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{n}{G}\PYG{+w}{ }\PYG{o}{*}\PYG{+w}{ }\PYG{n}{mass}\PYG{+w}{ }\PYG{o}{/}\PYG{+w}{ }\PYG{p}{(}\PYG{n}{radius}\PYG{+w}{ }\PYG{o}{*}\PYG{+w}{ }\PYG{n}{radius}\PYG{p}{);}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kt}{double}\PYG{+w}{ }\PYG{n+nf}{surfaceWeight}\PYG{p}{(}\PYG{k+kt}{double}\PYG{+w}{ }\PYG{n}{otherMass}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{n}{otherMass}\PYG{+w}{ }\PYG{o}{*}\PYG{+w}{ }\PYG{n}{surfaceGravity}\PYG{p}{();}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{p}{\PYGZcb{}}
\end{Verbatim}

View File

@ -1,6 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{n}{Scanner}\PYG{+w}{ }\PYG{n}{s}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{Scanner}\PYG{p}{(}\PYG{n}{System}\PYG{p}{.}\PYG{n+na}{in}\PYG{p}{);}
\PYG{n}{String}\PYG{+w}{ }\PYG{n}{param}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{s}\PYG{p}{.}\PYG{n+na}{next}\PYG{p}{();}
\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n}{value}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{s}\PYG{p}{.}\PYG{n+na}{nextInt}\PYG{p}{();}
\PYG{n}{s}\PYG{p}{.}\PYG{n+na}{close}\PYG{p}{();}
\end{Verbatim}

View File

@ -1,3 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{stop}\PYG{p}{()}
\end{Verbatim}

View File

@ -1,3 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{java}\PYG{p}{.}\PYG{n+na}{lang}\PYG{p}{.}\PYG{n+na}{Runnable}
\end{Verbatim}

View File

@ -1,3 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{String}\PYG{+w}{ }\PYG{n+nf}{replace}\PYG{p}{(}\PYG{k+kt}{char}\PYG{+w}{ }\PYG{n}{oldChar}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{char}\PYG{+w}{ }\PYG{n}{newChar}\PYG{p}{)}
\end{Verbatim}

View File

@ -1,3 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{expression}
\end{Verbatim}

View File

@ -1,3 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{String}\PYG{+w}{ }\PYG{o}{[]}\PYG{+w}{ }\PYG{n}{split}\PYG{p}{(}\PYG{n}{String}\PYG{+w}{ }\PYG{n}{regex}\PYG{p}{)}
\end{Verbatim}

View File

@ -1,3 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{String}\PYG{+w}{ }\PYG{n+nf}{strip}\PYG{p}{()}
\end{Verbatim}

View File

@ -1,3 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{k+kt}{boolean}\PYG{+w}{ }\PYG{n+nf}{equalsIgnoreCase}\PYG{p}{(}\PYG{n}{String}\PYG{+w}{ }\PYG{n}{anotherString}\PYG{p}{)}
\end{Verbatim}

View File

@ -1,7 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{n}{FileOutputStream}\PYG{+w}{ }\PYG{n}{out}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{FileOutputStream}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}theTime\PYGZdq{}}\PYG{p}{);}
\PYG{n}{ObjectOutputStream}\PYG{+w}{ }\PYG{n}{s}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{ObjectOutputStream}\PYG{p}{(}\PYG{n}{out}\PYG{p}{);}
\PYG{n}{s}\PYG{p}{.}\PYG{n+na}{writeObject}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Today\PYGZdq{}}\PYG{p}{);}
\PYG{n}{s}\PYG{p}{.}\PYG{n+na}{writeObject}\PYG{p}{(}\PYG{k}{new}\PYG{+w}{ }\PYG{n}{Date}\PYG{p}{());}
\PYG{n}{s}\PYG{p}{.}\PYG{n+na}{flush}\PYG{p}{();}
\end{Verbatim}

View File

@ -1,12 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{k}{try}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// statements that may throw an exception}
\PYG{p}{\PYGZcb{}}
\PYG{k}{catch}\PYG{+w}{ }\PYG{p}{(}\PYG{n}{ExceptionType}\PYG{+w}{ }\PYG{n}{exceptionReference}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// statemetns to process the exception}
\PYG{p}{\PYGZcb{}}
\PYG{c+c1}{// a `try` is followed by any number of `catch` blocks}
\PYG{k}{catch}\PYG{+w}{ }\PYG{p}{(}\PYG{n}{ExceptionType}\PYG{+w}{ }\PYG{n}{exceptionReference}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// statemetns to process the exception}
\PYG{p}{\PYGZcb{}}
\end{Verbatim}

View File

@ -1,3 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{Thread}
\end{Verbatim}

View File

@ -1,5 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{n}{Double}\PYG{o}{[]}\PYG{+w}{ }\PYG{n}{myDoubles}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{Double}\PYG{o}{[}\PYG{l+m+mi}{10}\PYG{o}{]}\PYG{p}{;}
\PYG{n}{myDoubles}\PYG{o}{[}\PYG{l+m+mi}{0}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{l+m+mf}{22.7}\PYG{p}{;}\PYG{+w}{ }\PYG{c+c1}{// autoboxed to a Double Object}
\PYG{k+kt}{double}\PYG{+w}{ }\PYG{n}{firstDoubleValue}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{myDoubles}\PYG{o}{[}\PYG{l+m+mi}{0}\PYG{o}{]}\PYG{p}{;}\PYG{+w}{ }\PYG{c+c1}{// auto-unboxed to a double primitive}
\end{Verbatim}

View File

@ -1,3 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{exit}\PYG{p}{()}
\end{Verbatim}

View File

@ -1,25 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{n}{assertTrue}\PYG{p}{(}\PYG{k+kt}{boolean}\PYG{+w}{ }\PYG{n}{test}\PYG{p}{)}
\PYG{n}{assertTrue}\PYG{p}{(}\PYG{n}{String}\PYG{+w}{ }\PYG{n}{message}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{boolean}\PYG{+w}{ }\PYG{n}{test}\PYG{p}{)}
\PYG{n}{assertFalse}\PYG{p}{(}\PYG{k+kt}{boolean}\PYG{+w}{ }\PYG{n}{test}\PYG{p}{)}
\PYG{n}{assertFalse}\PYG{p}{(}\PYG{n}{String}\PYG{+w}{ }\PYG{n}{message}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{boolean}\PYG{+w}{ }\PYG{n}{test}\PYG{p}{)}
\PYG{n}{assertEquals}\PYG{p}{(}\PYG{n}{Object}\PYG{+w}{ }\PYG{n}{expected}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{Object}\PYG{+w}{ }\PYG{n}{actual}\PYG{p}{)}
\PYG{n}{assertEquals}\PYG{p}{(}\PYG{n}{String}\PYG{+w}{ }\PYG{n}{message}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{Object}\PYG{+w}{ }\PYG{n}{expected}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{Object}\PYG{+w}{ }\PYG{n}{actual}\PYG{p}{)}
\PYG{n}{assertSame}\PYG{p}{(}\PYG{n}{Object}\PYG{+w}{ }\PYG{n}{expected}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{Object}\PYG{+w}{ }\PYG{n}{actual}\PYG{p}{)}
\PYG{n}{assertSame}\PYG{p}{(}\PYG{n}{String}\PYG{+w}{ }\PYG{n}{message}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{Object}\PYG{+w}{ }\PYG{n}{expected}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{Object}\PYG{+w}{ }\PYG{n}{actual}\PYG{p}{)}
\PYG{n}{assertNotSame}\PYG{p}{(}\PYG{n}{Object}\PYG{+w}{ }\PYG{n}{expected}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{Object}\PYG{+w}{ }\PYG{n}{actual}\PYG{p}{)}
\PYG{n}{assertNotSame}\PYG{p}{(}\PYG{n}{String}\PYG{+w}{ }\PYG{n}{message}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{Object}\PYG{+w}{ }\PYG{n}{expected}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{Object}\PYG{+w}{ }\PYG{n}{actual}\PYG{p}{)}
\PYG{n}{assertNull}\PYG{p}{(}\PYG{n}{Object}\PYG{+w}{ }\PYG{n}{object}\PYG{p}{)}
\PYG{n}{assertNull}\PYG{p}{(}\PYG{n}{String}\PYG{+w}{ }\PYG{n}{message}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{Object}\PYG{+w}{ }\PYG{n}{object}\PYG{p}{)}
\PYG{n}{assertNotNull}\PYG{p}{(}\PYG{n}{Object}\PYG{+w}{ }\PYG{n}{object}\PYG{p}{)}
\PYG{n}{assertNotNull}\PYG{p}{(}\PYG{n}{String}\PYG{+w}{ }\PYG{n}{message}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{Object}\PYG{+w}{ }\PYG{n}{object}\PYG{p}{)}
\PYG{n}{fail}\PYG{p}{()}
\PYG{n}{fail}\PYG{p}{(}\PYG{n}{String}\PYG{+w}{ }\PYG{n}{message}\PYG{p}{)}
\end{Verbatim}

View File

@ -1,4 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{n}{parameter}\PYG{+w}{ }\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{+w}{ }\PYG{n}{expression}
\PYG{p}{(}\PYG{n}{parameter1}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{parameter2}\PYG{p}{)}\PYG{+w}{ }\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{+w}{ }\PYG{n}{expression}
\end{Verbatim}

View File

@ -1,9 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{argtest}\PYG{p}{(}\PYG{n}{Object}\PYG{p}{...}\PYG{+w}{ }\PYG{n}{args}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{k}{for}\PYG{+w}{ }\PYG{p}{(}\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n}{i}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{l+m+mi}{0}\PYG{p}{;}\PYG{+w}{ }\PYG{n}{i}\PYG{+w}{ }\PYG{o}{\PYGZlt{}}\PYG{+w}{ }\PYG{n}{args}\PYG{p}{.}\PYG{n+na}{length}\PYG{p}{;}\PYG{+w}{ }\PYG{n}{i}\PYG{o}{++}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{p}{\PYGZcb{}}
\PYG{n}{argtest}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}test\PYGZdq{}}\PYG{p}{,}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}data\PYGZdq{}}\PYG{p}{);}
\end{Verbatim}

View File

@ -1,11 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{k+kd}{class} \PYG{n+nc}{EnclosingClass}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{p}{...}
\PYG{+w}{ }\PYG{k+kd}{static}\PYG{+w}{ }\PYG{k+kd}{class} \PYG{n+nc}{StaticNestedClass}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{p}{...}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{k+kd}{class} \PYG{n+nc}{InnerClass}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{p}{...}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{p}{\PYGZcb{}}
\end{Verbatim}

View File

@ -1,75 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{c+c1}{// Fig. 10.20: TokenTest.java}
\PYG{c+c1}{// Testing the StringTokenizer class of the java.util package}
\PYG{c+c1}{// Java core packages}
\PYG{k+kn}{import}\PYG{+w}{ }\PYG{n+nn}{java.util.*}\PYG{p}{;}
\PYG{k+kn}{import}\PYG{+w}{ }\PYG{n+nn}{java.awt.*}\PYG{p}{;}
\PYG{k+kn}{import}\PYG{+w}{ }\PYG{n+nn}{java.awt.event.*}\PYG{p}{;}
\PYG{c+c1}{// Java extension packages}
\PYG{k+kn}{import}\PYG{+w}{ }\PYG{n+nn}{javax.swing.*}\PYG{p}{;}
\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{class} \PYG{n+nc}{TokenTest}\PYG{+w}{ }\PYG{k+kd}{extends}\PYG{+w}{ }\PYG{n}{JFrame}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{k+kd}{private}\PYG{+w}{ }\PYG{n}{JLabel}\PYG{+w}{ }\PYG{n}{promptLabel}\PYG{p}{;}
\PYG{+w}{ }\PYG{k+kd}{private}\PYG{+w}{ }\PYG{n}{JTextField}\PYG{+w}{ }\PYG{n}{inputField}\PYG{p}{;}
\PYG{+w}{ }\PYG{k+kd}{private}\PYG{+w}{ }\PYG{n}{JTextArea}\PYG{+w}{ }\PYG{n}{outputArea}\PYG{p}{;}
\PYG{+w}{ }\PYG{c+c1}{// set up GUI and event handling}
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{n+nf}{TokenTest}\PYG{p}{()}
\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{k+kd}{super}\PYG{p}{(}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}Testing Class StringTokenizer\PYGZdq{}}\PYG{+w}{ }\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{Container}\PYG{+w}{ }\PYG{n}{container}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{getContentPane}\PYG{p}{();}
\PYG{+w}{ }\PYG{n}{container}\PYG{p}{.}\PYG{n+na}{setLayout}\PYG{p}{(}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{FlowLayout}\PYG{p}{()}\PYG{+w}{ }\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{promptLabel}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{JLabel}\PYG{p}{(}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}Enter a sentence and press Enter\PYGZdq{}}\PYG{+w}{ }\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{container}\PYG{p}{.}\PYG{n+na}{add}\PYG{p}{(}\PYG{+w}{ }\PYG{n}{promptLabel}\PYG{+w}{ }\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{inputField}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{JTextField}\PYG{p}{(}\PYG{+w}{ }\PYG{l+m+mi}{20}\PYG{+w}{ }\PYG{p}{);}\PYG{+w}{ }\PYG{c+c1}{// inputField contains String to be parsed by StringTokenizer}
\PYG{+w}{ }\PYG{n}{inputField}\PYG{p}{.}\PYG{n+na}{addActionListener}\PYG{p}{(}
\PYG{+w}{ }\PYG{c+c1}{// anonymous inner class}
\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{ActionListener}\PYG{p}{()}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// handle text field event}
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{n}{coid}\PYG{+w}{ }\PYG{n+nf}{actionPerformed}\PYG{p}{(}\PYG{n}{ActionEvent}\PYG{+w}{ }\PYG{n}{event}\PYG{p}{)}
\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{String}\PYG{+w}{ }\PYG{n}{stringToTokenize}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{event}\PYG{p}{.}\PYG{n+na}{getActionCommand}\PYG{p}{();}
\PYG{+w}{ }\PYG{n}{StringTokenizer}\PYG{+w}{ }\PYG{n}{tokens}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{StringTokenizer}\PYG{p}{(}\PYG{+w}{ }\PYG{n}{stringToTokenize}\PYG{+w}{ }\PYG{p}{);}\PYG{+w}{ }\PYG{c+c1}{// Use StringTokenizer to parse String stringToTokenize with default delimiters "{\textbackslash}n{\textbackslash}t{\textbackslash}r"}
\PYG{+w}{ }\PYG{n}{outputArea}\PYG{p}{.}\PYG{n+na}{setText}\PYG{p}{(}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}Number of elements: \PYGZdq{}}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{n}{tokens}\PYG{p}{.}\PYG{n+na}{countTokens}\PYG{p}{()}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}\PYGZbs{}nThe tokens are:\PYGZbs{}n\PYGZdq{}}\PYG{+w}{ }\PYG{p}{);}\PYG{+w}{ }\PYG{c+c1}{// count number of tokens}
\PYG{+w}{ }\PYG{c+c1}{// apend next token to outputArea as long as tokens exist}
\PYG{+w}{ }\PYG{k}{while}\PYG{+w}{ }\PYG{p}{(}\PYG{+w}{ }\PYG{n}{tokens}\PYG{p}{.}\PYG{n+na}{hasMoreTokens}\PYG{p}{()}\PYG{+w}{ }\PYG{p}{)}
\PYG{+w}{ }\PYG{n}{outputArea}\PYG{p}{.}\PYG{n+na}{append}\PYG{p}{(}\PYG{+w}{ }\PYG{n}{tokens}\PYG{p}{.}\PYG{n+na}{nextToken}\PYG{p}{()}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}\PYGZbs{}n\PYGZdq{}}\PYG{+w}{ }\PYG{p}{);}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}\PYG{+w}{ }\PYG{c+c1}{// end anonymous inner class}
\PYG{+w}{ }\PYG{p}{);}\PYG{+w}{ }\PYG{c+c1}{// end call to addActionListener}
\PYG{+w}{ }\PYG{n}{container}\PYG{p}{.}\PYG{n+na}{add}\PYG{p}{(}\PYG{+w}{ }\PYG{n}{inputField}\PYG{+w}{ }\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{outputArea}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{JTextArea}\PYG{p}{(}\PYG{+w}{ }\PYG{l+m+mi}{10}\PYG{p}{,}\PYG{+w}{ }\PYG{l+m+mi}{20}\PYG{+w}{ }\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{outputArea}\PYG{p}{.}\PYG{n+na}{setEditable}\PYG{p}{(}\PYG{+w}{ }\PYG{k+kc}{false}\PYG{+w}{ }\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{container}\PYG{p}{.}\PYG{n+na}{add}\PYG{p}{(}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{JScrollPane}\PYG{p}{(}\PYG{+w}{ }\PYG{n}{outputArea}\PYG{+w}{ }\PYG{p}{)}\PYG{+w}{ }\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{setSize}\PYG{p}{(}\PYG{+w}{ }\PYG{l+m+mi}{275}\PYG{p}{,}\PYG{+w}{ }\PYG{l+m+mi}{260}\PYG{+w}{ }\PYG{p}{);}\PYG{+w}{ }\PYG{c+c1}{// set the window size}
\PYG{+w}{ }\PYG{n}{show}\PYG{p}{();}\PYG{+w}{ }\PYG{c+c1}{// show the window}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{c+c1}{// execute application}
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{static}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{main}\PYG{p}{(}\PYG{+w}{ }\PYG{n}{String}\PYG{+w}{ }\PYG{n}{args}\PYG{o}{[]}\PYG{+w}{ }\PYG{p}{)}
\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{TokenTest}\PYG{+w}{ }\PYG{n}{application}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{TokenTest}\PYG{p}{();}
\PYG{+w}{ }\PYG{n}{application}\PYG{p}{.}\PYG{n+na}{addWindowListener}\PYG{p}{(}
\PYG{+w}{ }\PYG{c+c1}{// anonymous inner class}
\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{WindowAdapter}\PYG{p}{()}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// handle event when user closes window}
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{windowClosing}\PYG{p}{(}\PYG{+w}{ }\PYG{n}{WindowEvent}\PYG{+w}{ }\PYG{n}{windowEvent}\PYG{+w}{ }\PYG{p}{)}
\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{System}\PYG{p}{.}\PYG{n+na}{exit}\PYG{p}{(}\PYG{+w}{ }\PYG{l+m+mi}{0}\PYG{+w}{ }\PYG{p}{);}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}\PYG{+w}{ }\PYG{c+c1}{// end anonymous inner class}
\PYG{+w}{ }\PYG{p}{);}\PYG{+w}{ }\PYG{c+c1}{// end call to addWindowListener}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}\PYG{+w}{ }\PYG{c+c1}{// end method main}
\PYG{p}{\PYGZcb{}}\PYG{+w}{ }\PYG{c+c1}{// end class TokenTest}
\end{Verbatim}

View File

@ -1,4 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{n}{System}\PYG{p}{.}\PYG{n+na}{out}\PYG{p}{.}\PYG{n+na}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}name count\PYGZpc{}\PYGZbs{}n\PYGZdq{}}\PYG{p}{);}
\PYG{n}{System}\PYG{p}{.}\PYG{n+na}{out}\PYG{p}{.}\PYG{n+na}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}\PYGZpc{}s \PYGZpc{}5d\PYGZpc{}\PYGZbs{}n\PYGZdq{}}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{user}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{total}\PYG{p}{);}
\end{Verbatim}

View File

@ -1,3 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{abstract}\PYG{+w}{ }\PYG{k+kd}{class} \PYG{n+nc}{Employee}
\end{Verbatim}

View File

@ -1,3 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{Runnable}
\end{Verbatim}

View File

@ -1,3 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{java}\PYG{p}{.}\PYG{n+na}{lang}\PYG{p}{.}\PYG{n+na}{Thread}
\end{Verbatim}

View File

@ -1,5 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n+nf}{functionName}\PYG{+w}{ }\PYG{p}{(}\PYG{n}{paremeterList}\PYG{p}{)}\PYG{+w}{ }\PYG{k+kd}{throws}\PYG{+w}{ }\PYG{n}{ExceptionType1}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{ExceptionType2}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// method body}
\PYG{p}{\PYGZcb{}}
\end{Verbatim}

View File

@ -1,6 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{n}{FileInputStream}\PYG{+w}{ }\PYG{n}{in}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{FileInputStream}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}theTime\PYGZdq{}}\PYG{p}{);}
\PYG{n}{ObjectInputStream}\PYG{+w}{ }\PYG{n}{s}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{ObjectInputStream}\PYG{p}{(}\PYG{n}{in}\PYG{p}{);}
\PYG{n}{String}\PYG{+w}{ }\PYG{n}{today}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{p}{(}\PYG{n}{String}\PYG{p}{)}\PYG{+w}{ }\PYG{n}{s}\PYG{p}{.}\PYG{n+na}{readObject}\PYG{p}{();}
\PYG{n}{Date}\PYG{+w}{ }\PYG{n}{date}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{p}{(}\PYG{n}{Date}\PYG{p}{)}\PYG{+w}{ }\PYG{n}{s}\PYG{p}{.}\PYG{n+na}{readObject}\PYG{p}{();}
\end{Verbatim}

View File

@ -1,3 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{k}{new}\PYG{+w}{ }\PYG{n}{RandomAccessFile}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}farrago.txt\PYGZdq{}}\PYG{p}{,}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}rw\PYGZdq{}}\PYG{p}{);}
\end{Verbatim}

View File

@ -1,3 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{k+kd}{enum}\PYG{+w}{ }\PYG{n}{Days}\PYG{+w}{ }\PYG{p}{\PYGZob{}}\PYG{+w}{ }\PYG{n}{SUNDAY}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{MONDAY}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{TUESDAY}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{WEDNESDAY}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{THURSDAY}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{FRIDAY}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{SATURDAY}\PYG{+w}{ }\PYG{p}{\PYGZcb{};}
\end{Verbatim}

View File

@ -1,76 +0,0 @@
\makeatletter
\def\PYG@reset{\let\PYG@it=\relax \let\PYG@bf=\relax%
\let\PYG@ul=\relax \let\PYG@tc=\relax%
\let\PYG@bc=\relax \let\PYG@ff=\relax}
\def\PYG@tok#1{\csname PYG@tok@#1\endcsname}
\def\PYG@toks#1+{\ifx\relax#1\empty\else%
\PYG@tok{#1}\expandafter\PYG@toks\fi}
\def\PYG@do#1{\PYG@bc{\PYG@tc{\PYG@ul{%
\PYG@it{\PYG@bf{\PYG@ff{#1}}}}}}}
\def\PYG#1#2{\PYG@reset\PYG@toks#1+\relax+\PYG@do{#2}}
\@namedef{PYG@tok@c}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}}
\@namedef{PYG@tok@cp}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}}
\@namedef{PYG@tok@cs}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}}
\@namedef{PYG@tok@k}{\let\PYG@bf=\textbf}
\@namedef{PYG@tok@kd}{\let\PYG@bf=\textbf\let\PYG@it=\textit}
\@namedef{PYG@tok@nb}{\let\PYG@bf=\textbf\let\PYG@it=\textit}
\@namedef{PYG@tok@bp}{\let\PYG@bf=\textbf\let\PYG@it=\textit}
\@namedef{PYG@tok@nn}{\let\PYG@bf=\textbf\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@nc}{\let\PYG@bf=\textbf\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@nf}{\let\PYG@bf=\textbf\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@nv}{\let\PYG@bf=\textbf\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@no}{\let\PYG@bf=\textbf\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@ow}{\let\PYG@bf=\textbf}
\@namedef{PYG@tok@s}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@err}{\def\PYG@bc##1{{\setlength{\fboxsep}{\string -\fboxrule}\fcolorbox[rgb]{1.00,0.00,0.00}{1,1,1}{\strut ##1}}}}
\@namedef{PYG@tok@kc}{\let\PYG@bf=\textbf}
\@namedef{PYG@tok@kn}{\let\PYG@bf=\textbf}
\@namedef{PYG@tok@kp}{\let\PYG@bf=\textbf}
\@namedef{PYG@tok@kr}{\let\PYG@bf=\textbf}
\@namedef{PYG@tok@kt}{\let\PYG@bf=\textbf}
\@namedef{PYG@tok@fm}{\let\PYG@bf=\textbf\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@vc}{\let\PYG@bf=\textbf\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@vg}{\let\PYG@bf=\textbf\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@vi}{\let\PYG@bf=\textbf\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@vm}{\let\PYG@bf=\textbf\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@sa}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@sb}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@sc}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@dl}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@sd}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@s2}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@se}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@sh}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@si}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@sx}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@sr}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@s1}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@ss}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@ch}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}}
\@namedef{PYG@tok@cm}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}}
\@namedef{PYG@tok@cpf}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}}
\@namedef{PYG@tok@c1}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}}
\def\PYGZbs{\char`\\}
\def\PYGZus{\char`\_}
\def\PYGZob{\char`\{}
\def\PYGZcb{\char`\}}
\def\PYGZca{\char`\^}
\def\PYGZam{\char`\&}
\def\PYGZlt{\char`\<}
\def\PYGZgt{\char`\>}
\def\PYGZsh{\char`\#}
\def\PYGZpc{\char`\%}
\def\PYGZdl{\char`\$}
\def\PYGZhy{\char`\-}
\def\PYGZsq{\char`\'}
\def\PYGZdq{\char`\"}
\def\PYGZti{\char`\~}
% for compatibility with earlier versions
\def\PYGZat{@}
\def\PYGZlb{[}
\def\PYGZrb{]}
\makeatother

View File

@ -1,23 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{c+c1}{// class to implement Method 3 }
\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{class} \PYG{n+nc}{ReverseVSOriginal}\PYG{+w}{ }\PYG{k+kd}{implements}\PYG{+w}{ }\PYG{n}{PalindromeChecker}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// method 1 - reversed order String vs original String }
\PYG{+w}{ }\PYG{n+nd}{@Override}
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kt}{boolean}\PYG{+w}{ }\PYG{n+nf}{checkPalindrome}\PYG{p}{(}\PYG{n}{String}\PYG{+w}{ }\PYG{n}{str}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{String}\PYG{+w}{ }\PYG{n}{reversedStr}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}\PYGZdq{}}\PYG{p}{;}\PYG{+w}{ }\PYG{n}{NewPalindrome}\PYG{p}{.}\PYG{n+na}{operations}\PYG{o}{[}\PYG{l+m+mi}{0}\PYG{o}{]++}\PYG{p}{;}
\PYG{+w}{ }\PYG{c+c1}{// looping through each character in the String, backwards}
\PYG{+w}{ }\PYG{c+c1}{// incrementing operations counter by 2, 1 for initialisating i, 1 for getting str.length()}
\PYG{+w}{ }\PYG{n}{NewPalindrome}\PYG{p}{.}\PYG{n+na}{operations}\PYG{o}{[}\PYG{l+m+mi}{0}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{+=}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{p}{;}
\PYG{+w}{ }\PYG{k}{for}\PYG{+w}{ }\PYG{p}{(}\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n}{i}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{str}\PYG{p}{.}\PYG{n+na}{length}\PYG{p}{();}\PYG{+w}{ }\PYG{n}{i}\PYG{+w}{ }\PYG{o}{\PYGZgt{}}\PYG{+w}{ }\PYG{l+m+mi}{0}\PYG{p}{;}\PYG{+w}{ }\PYG{n}{i}\PYG{o}{\PYGZhy{}\PYGZhy{}}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{NewPalindrome}\PYG{p}{.}\PYG{n+na}{operations}\PYG{o}{[}\PYG{l+m+mi}{0}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{+=}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{p}{;}\PYG{+w}{ }\PYG{c+c1}{// for loop condition check & incrementing i}
\PYG{+w}{ }\PYG{n}{reversedStr}\PYG{+w}{ }\PYG{o}{+=}\PYG{+w}{ }\PYG{n}{str}\PYG{p}{.}\PYG{n+na}{charAt}\PYG{p}{(}\PYG{n}{i}\PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{1}\PYG{p}{);}\PYG{+w}{ }\PYG{n}{NewPalindrome}\PYG{p}{.}\PYG{n+na}{operations}\PYG{o}{[}\PYG{l+m+mi}{0}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{+=}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{p}{;}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{c+c1}{// returning true if the Strings are equal, false if not}
\PYG{+w}{ }\PYG{n}{NewPalindrome}\PYG{p}{.}\PYG{n+na}{operations}\PYG{o}{[}\PYG{l+m+mi}{0}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{+=}\PYG{+w}{ }\PYG{n}{str}\PYG{p}{.}\PYG{n+na}{length}\PYG{p}{();}\PYG{+w}{ }\PYG{c+c1}{// the equals method must loop through each character of the String to check that they are equal so it is O(n)}
\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{n}{str}\PYG{p}{.}\PYG{n+na}{equals}\PYG{p}{(}\PYG{n}{reversedStr}\PYG{p}{);}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{p}{\PYGZcb{}}
\end{Verbatim}

View File

@ -1,23 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{c+c1}{// class to implement Method 2 }
\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{class} \PYG{n+nc}{IVersusNMinusI}\PYG{+w}{ }\PYG{k+kd}{implements}\PYG{+w}{ }\PYG{n}{PalindromeChecker}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// method 2 - comparing each element at index i to the element at n - i where n is the last index}
\PYG{+w}{ }\PYG{n+nd}{@Override}
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kt}{boolean}\PYG{+w}{ }\PYG{n+nf}{checkPalindrome}\PYG{p}{(}\PYG{n}{String}\PYG{+w}{ }\PYG{n}{str}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// looping through the first half of the String }
\PYG{+w}{ }\PYG{n}{NewPalindrome}\PYG{p}{.}\PYG{n+na}{operations}\PYG{o}{[}\PYG{l+m+mi}{1}\PYG{o}{]++}\PYG{p}{;}
\PYG{+w}{ }\PYG{k}{for}\PYG{+w}{ }\PYG{p}{(}\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n}{i}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{l+m+mi}{0}\PYG{p}{;}\PYG{+w}{ }\PYG{n}{i}\PYG{+w}{ }\PYG{o}{\PYGZlt{}}\PYG{+w}{ }\PYG{n}{Math}\PYG{p}{.}\PYG{n+na}{floor}\PYG{p}{(}\PYG{n}{str}\PYG{p}{.}\PYG{n+na}{length}\PYG{p}{()}\PYG{+w}{ }\PYG{o}{/}\PYG{+w}{ }\PYG{l+m+mi}{2}\PYG{p}{);}\PYG{+w}{ }\PYG{n}{i}\PYG{o}{++}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{NewPalindrome}\PYG{p}{.}\PYG{n+na}{operations}\PYG{o}{[}\PYG{l+m+mi}{1}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{+=}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{p}{;}\PYG{+w}{ }\PYG{c+c1}{// 1 for the getting str.length(), 1 for Math,floor, 1 for checking condition, 1 for incrementing}
\PYG{+w}{ }\PYG{c+c1}{// returning false if the digits don't match}
\PYG{+w}{ }\PYG{n}{NewPalindrome}\PYG{p}{.}\PYG{n+na}{operations}\PYG{o}{[}\PYG{l+m+mi}{1}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{+=}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{p}{;}\PYG{+w}{ }\PYG{c+c1}{// 1 for str.charAt(i), 1 for ((str.lenght() -1) - 1), 1 for the other str.charAt(), 1 for checking the condition}
\PYG{+w}{ }\PYG{k}{if}\PYG{+w}{ }\PYG{p}{(}\PYG{n}{str}\PYG{p}{.}\PYG{n+na}{charAt}\PYG{p}{(}\PYG{n}{i}\PYG{p}{)}\PYG{+w}{ }\PYG{o}{!=}\PYG{+w}{ }\PYG{n}{str}\PYG{p}{.}\PYG{n+na}{charAt}\PYG{p}{((}\PYG{n}{str}\PYG{p}{.}\PYG{n+na}{length}\PYG{p}{()}\PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{1}\PYG{p}{)}\PYG{+w}{ }\PYG{o}{\PYGZhy{}}\PYG{+w}{ }\PYG{n}{i}\PYG{p}{))}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{k+kc}{false}\PYG{p}{;}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{c+c1}{// returning true as default}
\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{k+kc}{true}\PYG{p}{;}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{p}{\PYGZcb{}}
\end{Verbatim}

View File

@ -1,5 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{interface} \PYG{n+nc}{PalindromeChecker}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kt}{boolean}\PYG{+w}{ }\PYG{n+nf}{checkPalindrome}\PYG{p}{(}\PYG{n}{String}\PYG{+w}{ }\PYG{n}{str}\PYG{p}{);}
\PYG{p}{\PYGZcb{}}
\end{Verbatim}

View File

@ -1,31 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{c+c1}{// class to implement method 4 }
\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{class} \PYG{n+nc}{RecursiveReverse}\PYG{+w}{ }\PYG{k+kd}{implements}\PYG{+w}{ }\PYG{n}{PalindromeChecker}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// comparing the String reversed using recursion to the original String (essentially method 1 but with recursion)}
\PYG{+w}{ }\PYG{n+nd}{@Override}\PYG{+w}{ }
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kt}{boolean}\PYG{+w}{ }\PYG{n+nf}{checkPalindrome}\PYG{p}{(}\PYG{n}{String}\PYG{+w}{ }\PYG{n}{str}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// returning true if the original String is equal to the reversed String, false if not}
\PYG{+w}{ }\PYG{n}{NewPalindrome}\PYG{p}{.}\PYG{n+na}{operations}\PYG{o}{[}\PYG{l+m+mi}{3}\PYG{o}{]++}\PYG{p}{;}\PYG{+w}{ }
\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{n}{str}\PYG{p}{.}\PYG{n+na}{equals}\PYG{p}{(}\PYG{n}{reverse}\PYG{p}{(}\PYG{n}{str}\PYG{p}{));}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{c+c1}{// method to reverse the characters in a String using recursion }
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{static}\PYG{+w}{ }\PYG{n}{String}\PYG{+w}{ }\PYG{n+nf}{reverse}\PYG{p}{(}\PYG{n}{String}\PYG{+w}{ }\PYG{n}{str}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// base case - returning an empty String if there is no character left in the String}
\PYG{+w}{ }\PYG{n}{NewPalindrome}\PYG{p}{.}\PYG{n+na}{operations}\PYG{o}{[}\PYG{l+m+mi}{3}\PYG{o}{]++}\PYG{p}{;}
\PYG{+w}{ }\PYG{k}{if}\PYG{+w}{ }\PYG{p}{(}\PYG{n}{str}\PYG{p}{.}\PYG{n+na}{length}\PYG{p}{()}\PYG{+w}{ }\PYG{o}{==}\PYG{+w}{ }\PYG{l+m+mi}{0}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}\PYG{+w}{ }
\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}\PYGZdq{}}\PYG{p}{;}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{k}{else}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{k+kt}{char}\PYG{+w}{ }\PYG{n}{firstChar}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{str}\PYG{p}{.}\PYG{n+na}{charAt}\PYG{p}{(}\PYG{l+m+mi}{0}\PYG{p}{);}\PYG{+w}{ }\PYG{n}{NewPalindrome}\PYG{p}{.}\PYG{n+na}{operations}\PYG{o}{[}\PYG{l+m+mi}{3}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{+=}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{p}{;}
\PYG{+w}{ }\PYG{n}{String}\PYG{+w}{ }\PYG{n}{remainder}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{str}\PYG{p}{.}\PYG{n+na}{substring}\PYG{p}{(}\PYG{l+m+mi}{1}\PYG{p}{);}\PYG{+w}{ }\PYG{n}{NewPalindrome}\PYG{p}{.}\PYG{n+na}{operations}\PYG{o}{[}\PYG{l+m+mi}{3}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{+=}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{p}{;}\PYG{+w}{ }\PYG{c+c1}{// selecting the rest of the String, excluding the 0th character}
\PYG{+w}{ }\PYG{c+c1}{// recursing with what's left of the String}
\PYG{+w}{ }\PYG{n}{String}\PYG{+w}{ }\PYG{n}{reversedRemainder}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{reverse}\PYG{p}{(}\PYG{n}{remainder}\PYG{p}{);}\PYG{+w}{ }\PYG{n}{NewPalindrome}\PYG{p}{.}\PYG{n+na}{operations}\PYG{o}{[}\PYG{l+m+mi}{3}\PYG{o}{]++}\PYG{p}{;}
\PYG{+w}{ }\PYG{c+c1}{// returning the reversed rest of String with the first character of the String appended}
\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{n}{reversedRemainder}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{n}{firstChar}\PYG{p}{;}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{p}{\PYGZcb{}}
\end{Verbatim}

View File

@ -1,50 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{c+c1}{// class to implement method 3 }
\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{class} \PYG{n+nc}{StackVSQueue}\PYG{+w}{ }\PYG{k+kd}{implements}\PYG{+w}{ }\PYG{n}{PalindromeChecker}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// method 3 - using a stack and a queue to do, essentially, what method 2 does (compare the first index to the last index, etc.)}
\PYG{+w}{ }\PYG{n+nd}{@Override}
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kt}{boolean}\PYG{+w}{ }\PYG{n+nf}{checkPalindrome}\PYG{p}{(}\PYG{n}{String}\PYG{+w}{ }\PYG{n}{str}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{ArrayStack}\PYG{+w}{ }\PYG{n}{stack}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{ArrayStack}\PYG{p}{();}\PYG{+w}{ }\PYG{n}{NewPalindrome}\PYG{p}{.}\PYG{n+na}{operations}\PYG{o}{[}\PYG{l+m+mi}{2}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{+=}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{p}{;}
\PYG{+w}{ }\PYG{n}{ArrayQueue}\PYG{+w}{ }\PYG{n}{queue}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{ArrayQueue}\PYG{p}{();}\PYG{+w}{ }\PYG{n}{NewPalindrome}\PYG{p}{.}\PYG{n+na}{operations}\PYG{o}{[}\PYG{l+m+mi}{2}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{+=}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{p}{;}
\PYG{+w}{ }\PYG{c+c1}{// looping through each character in the String and adding the character to the stack & queue }
\PYG{+w}{ }\PYG{n}{NewPalindrome}\PYG{p}{.}\PYG{n+na}{operations}\PYG{o}{[}\PYG{l+m+mi}{2}\PYG{o}{]++}\PYG{p}{;}
\PYG{+w}{ }\PYG{k}{for}\PYG{+w}{ }\PYG{p}{(}\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n}{i}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{l+m+mi}{0}\PYG{p}{;}\PYG{+w}{ }\PYG{n}{i}\PYG{+w}{ }\PYG{o}{\PYGZlt{}}\PYG{+w}{ }\PYG{n}{str}\PYG{p}{.}\PYG{n+na}{length}\PYG{p}{();}\PYG{+w}{ }\PYG{n}{i}\PYG{o}{++}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{NewPalindrome}\PYG{p}{.}\PYG{n+na}{operations}\PYG{o}{[}\PYG{l+m+mi}{2}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{+=}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{p}{;}
\PYG{+w}{ }\PYG{n}{stack}\PYG{p}{.}\PYG{n+na}{push}\PYG{p}{(}\PYG{n}{str}\PYG{p}{.}\PYG{n+na}{charAt}\PYG{p}{(}\PYG{n}{i}\PYG{p}{));}\PYG{+w}{ }\PYG{n}{NewPalindrome}\PYG{p}{.}\PYG{n+na}{operations}\PYG{o}{[}\PYG{l+m+mi}{2}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{+=}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{p}{;}
\PYG{+w}{ }\PYG{n}{queue}\PYG{p}{.}\PYG{n+na}{enqueue}\PYG{p}{(}\PYG{n}{str}\PYG{p}{.}\PYG{n+na}{charAt}\PYG{p}{(}\PYG{n}{i}\PYG{p}{));}\PYG{+w}{ }\PYG{n}{NewPalindrome}\PYG{p}{.}\PYG{n+na}{operations}\PYG{o}{[}\PYG{l+m+mi}{2}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{+=}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{p}{;}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{c+c1}{// looping through each character on the stack & queue and comparing them, returning false if they're different}
\PYG{+w}{ }\PYG{n}{NewPalindrome}\PYG{p}{.}\PYG{n+na}{operations}\PYG{o}{[}\PYG{l+m+mi}{2}\PYG{o}{]++}\PYG{p}{;}
\PYG{+w}{ }\PYG{k}{for}\PYG{+w}{ }\PYG{p}{(}\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n}{i}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{l+m+mi}{0}\PYG{p}{;}\PYG{+w}{ }\PYG{n}{i}\PYG{+w}{ }\PYG{o}{\PYGZlt{}}\PYG{+w}{ }\PYG{n}{str}\PYG{p}{.}\PYG{n+na}{length}\PYG{p}{();}\PYG{+w}{ }\PYG{n}{i}\PYG{o}{++}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{NewPalindrome}\PYG{p}{.}\PYG{n+na}{operations}\PYG{o}{[}\PYG{l+m+mi}{2}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{+=}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{p}{;}
\PYG{+w}{ }\PYG{n}{NewPalindrome}\PYG{p}{.}\PYG{n+na}{operations}\PYG{o}{[}\PYG{l+m+mi}{2}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{+=}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{p}{;}
\PYG{+w}{ }\PYG{k}{if}\PYG{+w}{ }\PYG{p}{(}\PYG{o}{!}\PYG{n}{stack}\PYG{p}{.}\PYG{n+na}{pop}\PYG{p}{().}\PYG{n+na}{equals}\PYG{p}{(}\PYG{n}{queue}\PYG{p}{.}\PYG{n+na}{front}\PYG{p}{()))}\PYG{+w}{ }\PYG{p}{\PYGZob{}}\PYG{+w}{ }
\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{k+kc}{false}\PYG{p}{;}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{c+c1}{// the complexity of ArrayQueue.dequeue() is 3n+2, where n is the number of items in the queue when dequeue() is called. }
\PYG{+w}{ }\PYG{c+c1}{// we need to determine the number of items in the queue so that we can determine the number of primitive operations performed when queue.dequeue() is called.}
\PYG{+w}{ }\PYG{c+c1}{// to do this, we'll loop through the queue, dequeuing each object and enqueueing it in another ArrayQueue. once complete, we'll reassign the variable queue to point to the new ArrayQueue containing all the objects}
\PYG{+w}{ }\PYG{n}{ArrayQueue}\PYG{+w}{ }\PYG{n}{newQueue}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{ArrayQueue}\PYG{p}{();}\PYG{+w}{ }\PYG{c+c1}{// not counting the operations for this as it's not part of the algorithm, it's part of the operations counting}
\PYG{+w}{ }\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n}{n}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{l+m+mi}{0}\PYG{p}{;}\PYG{+w}{ }\PYG{c+c1}{// n is the number of items in the ArrayQueue when dequeue() is called}
\PYG{+w}{ }\PYG{k}{while}\PYG{+w}{ }\PYG{p}{(}\PYG{o}{!}\PYG{n}{queue}\PYG{p}{.}\PYG{n+na}{isEmpty}\PYG{p}{())}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{newQueue}\PYG{p}{.}\PYG{n+na}{enqueue}\PYG{p}{(}\PYG{n}{queue}\PYG{p}{.}\PYG{n+na}{dequeue}\PYG{p}{());}
\PYG{+w}{ }\PYG{n}{n}\PYG{o}{++}\PYG{p}{;}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }
\PYG{+w}{ }\PYG{n}{queue}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{newQueue}\PYG{p}{;}\PYG{+w}{ }\PYG{c+c1}{// setting queue to point to the newQueue, which is just the state that queue would have been in if we didn't do this to calculate the primitive operations}
\PYG{+w}{ }\PYG{n}{newQueue}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k+kc}{null}\PYG{p}{;}\PYG{+w}{ }\PYG{c+c1}{// don't need the newQueue object reference anymore}
\PYG{+w}{ }
\PYG{+w}{ }\PYG{n}{NewPalindrome}\PYG{p}{.}\PYG{n+na}{operations}\PYG{o}{[}\PYG{l+m+mi}{2}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{+=}\PYG{+w}{ }\PYG{l+m+mi}{3}\PYG{o}{*}\PYG{n}{n}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{2}\PYG{p}{;}\PYG{+w}{ }\PYG{c+c1}{// complexity of dequeue is 3n+2}
\PYG{+w}{ }\PYG{n}{queue}\PYG{p}{.}\PYG{n+na}{dequeue}\PYG{p}{();}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{k+kc}{true}\PYG{p}{;}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{p}{\PYGZcb{}}
\end{Verbatim}

View File

@ -1,95 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{k+kn}{import}\PYG{+w}{ }\PYG{n+nn}{java.io.*}\PYG{p}{;}
\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{class} \PYG{n+nc}{NewPalindrome}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{static}\PYG{+w}{ }\PYG{k+kt}{long}\PYG{o}{[]}\PYG{+w}{ }\PYG{n}{operations}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{k+kt}{long}\PYG{o}{[}\PYG{l+m+mi}{4}\PYG{o}{]}\PYG{p}{;}\PYG{+w}{ }\PYG{c+c1}{// array to contain the global operations count for each method }
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{static}\PYG{+w}{ }\PYG{k+kt}{int}\PYG{o}{[]}\PYG{+w}{ }\PYG{n}{decCount}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{k+kt}{int}\PYG{o}{[}\PYG{l+m+mi}{4}\PYG{o}{]}\PYG{p}{;}\PYG{+w}{ }\PYG{c+c1}{// array to hold the count of decimal palindromes found using each method}
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{static}\PYG{+w}{ }\PYG{k+kt}{int}\PYG{o}{[]}\PYG{+w}{ }\PYG{n}{binCount}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{k+kt}{int}\PYG{o}{[}\PYG{l+m+mi}{4}\PYG{o}{]}\PYG{p}{;}\PYG{+w}{ }\PYG{c+c1}{// array to hold the count of binary palindromes found using each method}
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{static}\PYG{+w}{ }\PYG{k+kt}{int}\PYG{o}{[]}\PYG{+w}{ }\PYG{n}{bothCount}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{k+kt}{int}\PYG{o}{[}\PYG{l+m+mi}{4}\PYG{o}{]}\PYG{p}{;}\PYG{+w}{ }\PYG{c+c1}{// array to hold the count of numbers that are palindromes in both decimal & binary found using each method}
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{static}\PYG{+w}{ }\PYG{k+kt}{long}\PYG{o}{[]}\PYG{+w}{ }\PYG{n}{startTime}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{k+kt}{long}\PYG{o}{[}\PYG{l+m+mi}{4}\PYG{o}{]}\PYG{p}{;}\PYG{+w}{ }\PYG{c+c1}{// array to hold the start time of each method's test loop}
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{static}\PYG{+w}{ }\PYG{k+kt}{long}\PYG{o}{[]}\PYG{+w}{ }\PYG{n}{totalTime}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{k+kt}{long}\PYG{o}{[}\PYG{l+m+mi}{4}\PYG{o}{]}\PYG{p}{;}\PYG{+w}{ }\PYG{c+c1}{// array to hold the total time of each method's test loop}
\PYG{+w}{ }\PYG{c+c1}{// array to hold all the String versions of the numbers so that they don't have to be generated for each method}
\PYG{+w}{ }\PYG{c+c1}{// 0th column will be decimal, 1st column will be binary}
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{static}\PYG{+w}{ }\PYG{n}{String}\PYG{o}{[][]}\PYG{+w}{ }\PYG{n}{strings}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{String}\PYG{o}{[}\PYG{l+m+mi}{1\PYGZus{}000\PYGZus{}001}\PYG{o}{][}\PYG{l+m+mi}{2}\PYG{o}{]}\PYG{p}{;}
\PYG{+w}{ }\PYG{c+c1}{// array of StringBuilder objects used to hold the csv data (size of problem, number of operations) for each method}
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{static}\PYG{+w}{ }\PYG{n}{StringBuilder}\PYG{o}{[]}\PYG{+w}{ }\PYG{n}{data}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{StringBuilder}\PYG{o}{[}\PYG{l+m+mi}{4}\PYG{o}{]}\PYG{p}{;}\PYG{+w}{ }
\PYG{+w}{ }\PYG{c+c1}{// array of the four classes that will be tested}
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{static}\PYG{+w}{ }\PYG{n}{PalindromeChecker}\PYG{o}{[]}\PYG{+w}{ }\PYG{n}{palindromeCheckers}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{p}{\PYGZob{}}\PYG{k}{new}\PYG{+w}{ }\PYG{n}{ReverseVSOriginal}\PYG{p}{(),}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{IVersusNMinusI}\PYG{p}{(),}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{StackVSQueue}\PYG{p}{(),}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{RecursiveReverse}\PYG{p}{()\PYGZcb{};}\PYG{+w}{ }
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{static}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{main}\PYG{p}{(}\PYG{n}{String}\PYG{+w}{ }\PYG{n}{args}\PYG{o}{[]}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// initialising the data array to StringBuilder objects}
\PYG{+w}{ }\PYG{k}{for}\PYG{+w}{ }\PYG{p}{(}\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n}{i}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{l+m+mi}{0}\PYG{p}{;}\PYG{+w}{ }\PYG{n}{i}\PYG{+w}{ }\PYG{o}{\PYGZlt{}}\PYG{+w}{ }\PYG{l+m+mi}{4}\PYG{p}{;}\PYG{+w}{ }\PYG{n}{i}\PYG{o}{++}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{data}\PYG{o}{[}\PYG{n}{i}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{StringBuilder}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}operations,size\PYGZbs{}n\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{c+c1}{// filling up the strings array}
\PYG{+w}{ }\PYG{k}{for}\PYG{+w}{ }\PYG{p}{(}\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n}{i}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{l+m+mi}{0}\PYG{p}{;}\PYG{+w}{ }\PYG{n}{i}\PYG{+w}{ }\PYG{o}{\PYGZlt{}=}\PYG{+w}{ }\PYG{l+m+mi}{1\PYGZus{}000\PYGZus{}000}\PYG{p}{;}\PYG{+w}{ }\PYG{n}{i}\PYG{o}{++}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{strings}\PYG{o}{[}\PYG{n}{i}\PYG{o}{][}\PYG{l+m+mi}{0}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{Integer}\PYG{p}{.}\PYG{n+na}{toString}\PYG{p}{(}\PYG{n}{i}\PYG{p}{,}\PYG{+w}{ }\PYG{l+m+mi}{10}\PYG{p}{);}\PYG{+w}{ }\PYG{c+c1}{// converting i to a String base 10}
\PYG{+w}{ }\PYG{n}{strings}\PYG{o}{[}\PYG{n}{i}\PYG{o}{][}\PYG{l+m+mi}{1}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{binary2string}\PYG{p}{(}\PYG{n}{strings}\PYG{o}{[}\PYG{n}{i}\PYG{o}{][}\PYG{l+m+mi}{0}\PYG{o}{]}\PYG{p}{);}\PYG{+w}{ }\PYG{c+c1}{// converting the decimal String to a binary String}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{c+c1}{// looping through each PalindromeChecker object in the palindromeCheckers array}
\PYG{+w}{ }\PYG{k}{for}\PYG{+w}{ }\PYG{p}{(}\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n}{j}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{l+m+mi}{0}\PYG{p}{;}\PYG{+w}{ }\PYG{n}{j}\PYG{+w}{ }\PYG{o}{\PYGZlt{}}\PYG{+w}{ }\PYG{l+m+mi}{4}\PYG{p}{;}\PYG{+w}{ }\PYG{n}{j}\PYG{o}{++}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// getting start time }
\PYG{+w}{ }\PYG{n}{startTime}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{System}\PYG{p}{.}\PYG{n+na}{currentTimeMillis}\PYG{p}{();}\PYG{+w}{ }\PYG{n}{operations}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]++}\PYG{p}{;}
\PYG{+w}{ }\PYG{c+c1}{// looping through the numbers 0 to 1,000,000 and checking if their binary & decimal representations are palindromic}
\PYG{+w}{ }\PYG{n}{operations}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]++}\PYG{p}{;}
\PYG{+w}{ }\PYG{k}{for}\PYG{+w}{ }\PYG{p}{(}\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n}{i}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{l+m+mi}{0}\PYG{p}{;}\PYG{+w}{ }\PYG{n}{i}\PYG{+w}{ }\PYG{o}{\PYGZlt{}=}\PYG{+w}{ }\PYG{l+m+mi}{1\PYGZus{}000\PYGZus{}000}\PYG{p}{;}\PYG{+w}{ }\PYG{n}{i}\PYG{o}{++}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// incrementing the operations count by 2, 1 for the loop condition check and 1 for incrementing i}
\PYG{+w}{ }\PYG{n}{operations}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{+=}\PYG{+w}{ }\PYG{l+m+mi}{2}\PYG{p}{;}
\PYG{+w}{ }\PYG{c+c1}{// converting the number to a decimal or binary String and checking if is a palindrome}
\PYG{+w}{ }\PYG{k+kt}{boolean}\PYG{+w}{ }\PYG{n}{isDecPalindrome}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{palindromeCheckers}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]}\PYG{p}{.}\PYG{n+na}{checkPalindrome}\PYG{p}{(}\PYG{n}{strings}\PYG{o}{[}\PYG{n}{i}\PYG{o}{][}\PYG{l+m+mi}{0}\PYG{o}{]}\PYG{p}{);}\PYG{+w}{ }\PYG{n}{operations}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]++}\PYG{p}{;}
\PYG{+w}{ }\PYG{k+kt}{boolean}\PYG{+w}{ }\PYG{n}{isBinPalindrome}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{palindromeCheckers}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]}\PYG{p}{.}\PYG{n+na}{checkPalindrome}\PYG{p}{(}\PYG{n}{strings}\PYG{o}{[}\PYG{n}{i}\PYG{o}{][}\PYG{l+m+mi}{1}\PYG{o}{]}\PYG{p}{);}\PYG{+w}{ }\PYG{n}{operations}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]++}\PYG{p}{;}\PYG{+w}{ }
\PYG{+w}{ }\PYG{c+c1}{// incrementing the appropriate counter if the number is a palindrome in that base}
\PYG{+w}{ }\PYG{n}{decCount}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{isDecPalindrome}\PYG{+w}{ }\PYG{o}{?}\PYG{+w}{ }\PYG{n}{decCount}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{p}{:}\PYG{+w}{ }\PYG{n}{decCount}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]}\PYG{p}{;}\PYG{+w}{ }\PYG{n}{operations}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{+=}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{p}{;}\PYG{+w}{ }\PYG{c+c1}{// incremnting by 2, 1 for assignment, 1 for condition check}
\PYG{+w}{ }\PYG{n}{binCount}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{isBinPalindrome}\PYG{+w}{ }\PYG{o}{?}\PYG{+w}{ }\PYG{n}{binCount}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{p}{:}\PYG{+w}{ }\PYG{n}{binCount}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]}\PYG{p}{;}\PYG{+w}{ }\PYG{n}{operations}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{+=}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{p}{;}
\PYG{+w}{ }\PYG{n}{bothCount}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{isDecPalindrome}\PYG{+w}{ }\PYG{o}{\PYGZam{}\PYGZam{}}\PYG{+w}{ }\PYG{n}{isBinPalindrome}\PYG{+w}{ }\PYG{o}{?}\PYG{+w}{ }\PYG{n}{bothCount}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{p}{:}\PYG{+w}{ }\PYG{n}{bothCount}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]}\PYG{p}{;}\PYG{+w}{ }\PYG{n}{operations}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{+=}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{l+m+mi}{1}\PYG{p}{;}\PYG{+w}{ }\PYG{c+c1}{// 2 condition checks and one assignment, so incrementing by 3}
\PYG{+w}{ }\PYG{c+c1}{// appending to the data StringBuilder at intervals of 50,000 }
\PYG{+w}{ }\PYG{k}{if}\PYG{+w}{ }\PYG{p}{(}\PYG{n}{i}\PYG{+w}{ }\PYG{o}{\PYGZpc{}}\PYG{+w}{ }\PYG{l+m+mi}{50\PYGZus{}000}\PYG{+w}{ }\PYG{o}{==}\PYG{+w}{ }\PYG{l+m+mi}{0}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{data}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]}\PYG{p}{.}\PYG{n+na}{append}\PYG{p}{(}\PYG{n}{operations}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{},\PYGZdq{}}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{n}{i}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}\PYGZbs{}n\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{c+c1}{// calculating total time taken for method 1 and printing out the results}
\PYG{+w}{ }\PYG{n}{totalTime}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{System}\PYG{p}{.}\PYG{n+na}{currentTimeMillis}\PYG{p}{()}\PYG{+w}{ }\PYG{o}{\PYGZhy{}}\PYG{+w}{ }\PYG{n}{startTime}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]}\PYG{p}{;}\PYG{+w}{ }\PYG{n}{operations}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{+=}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{p}{;}\PYG{+w}{ }\PYG{c+c1}{// incrementing by 2, 1 for getting current time and subtracting start time, 1 for assignment}
\PYG{+w}{ }\PYG{n}{System}\PYG{p}{.}\PYG{n+na}{out}\PYG{p}{.}\PYG{n+na}{println}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Number of decimal palindromes found using Method \PYGZdq{}}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{n}{j}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}: \PYGZdq{}}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{n}{decCount}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]}\PYG{p}{);}\PYG{+w}{ }
\PYG{+w}{ }\PYG{n}{System}\PYG{p}{.}\PYG{n+na}{out}\PYG{p}{.}\PYG{n+na}{println}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Number of binary palindromes found using Method \PYGZdq{}}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{n}{j}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}: \PYGZdq{}}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{n}{binCount}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]}\PYG{p}{);}\PYG{+w}{ }
\PYG{+w}{ }\PYG{n}{System}\PYG{p}{.}\PYG{n+na}{out}\PYG{p}{.}\PYG{n+na}{println}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Number of palindromes in both decimal \PYGZam{} binary found using Method \PYGZdq{}}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{n}{j}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}: \PYGZdq{}}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{n}{bothCount}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]}\PYG{p}{);}\PYG{+w}{ }
\PYG{+w}{ }\PYG{n}{System}\PYG{p}{.}\PYG{n+na}{out}\PYG{p}{.}\PYG{n+na}{println}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Number of primitive operations taken in Method \PYGZdq{}}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{n}{j}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}: \PYGZdq{}}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{n}{operations}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{System}\PYG{p}{.}\PYG{n+na}{out}\PYG{p}{.}\PYG{n+na}{println}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Time taken for Method \PYGZdq{}}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{n}{j}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}: \PYGZdq{}}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{n}{totalTime}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{} milliseconds\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{System}\PYG{p}{.}\PYG{n+na}{out}\PYG{p}{.}\PYG{n+na}{println}\PYG{p}{();}
\PYG{+w}{ }\PYG{c+c1}{// outputting the data to separate csv files}
\PYG{+w}{ }\PYG{k}{try}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{String}\PYG{+w}{ }\PYG{n}{filename}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}method\PYGZdq{}}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{n}{j}\PYG{+w}{ }\PYG{o}{+}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}.csv\PYGZdq{}}\PYG{p}{;}
\PYG{+w}{ }\PYG{n}{File}\PYG{+w}{ }\PYG{n}{csv}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{File}\PYG{p}{(}\PYG{n}{filename}\PYG{p}{);}
\PYG{+w}{ }
\PYG{+w}{ }\PYG{c+c1}{// creating file if it doesn't already exist}
\PYG{+w}{ }\PYG{n}{csv}\PYG{p}{.}\PYG{n+na}{createNewFile}\PYG{p}{();}
\PYG{+w}{ }\PYG{n}{FileWriter}\PYG{+w}{ }\PYG{n}{writer}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{k}{new}\PYG{+w}{ }\PYG{n}{FileWriter}\PYG{p}{(}\PYG{n}{filename}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{writer}\PYG{p}{.}\PYG{n+na}{write}\PYG{p}{(}\PYG{n}{data}\PYG{o}{[}\PYG{n}{j}\PYG{o}{]}\PYG{p}{.}\PYG{n+na}{toString}\PYG{p}{());}
\PYG{+w}{ }\PYG{n}{writer}\PYG{p}{.}\PYG{n+na}{close}\PYG{p}{();}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}\PYG{+w}{ }\PYG{k}{catch}\PYG{+w}{ }\PYG{p}{(}\PYG{n}{IOException}\PYG{+w}{ }\PYG{n}{e}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{System}\PYG{p}{.}\PYG{n+na}{out}\PYG{p}{.}\PYG{n+na}{println}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}IO Error occurred\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{e}\PYG{p}{.}\PYG{n+na}{printStackTrace}\PYG{p}{();}
\PYG{+w}{ }\PYG{n}{System}\PYG{p}{.}\PYG{n+na}{exit}\PYG{p}{(}\PYG{l+m+mi}{1}\PYG{p}{);}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{c+c1}{// utility method to convert a decimal String to its equivalent binary String}
\PYG{+w}{ }\PYG{k+kd}{public}\PYG{+w}{ }\PYG{k+kd}{static}\PYG{+w}{ }\PYG{n}{String}\PYG{+w}{ }\PYG{n+nf}{binary2string}\PYG{p}{(}\PYG{n}{String}\PYG{+w}{ }\PYG{n}{decimalStr}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{n}{Integer}\PYG{p}{.}\PYG{n+na}{toString}\PYG{p}{(}\PYG{n}{Integer}\PYG{p}{.}\PYG{n+na}{parseInt}\PYG{p}{(}\PYG{n}{decimalStr}\PYG{p}{),}\PYG{+w}{ }\PYG{l+m+mi}{2}\PYG{p}{);}\PYG{+w}{ }\PYG{c+c1}{// parsing the String to an int and then parsing that int to a binary String }
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{p}{\PYGZcb{}}
\end{Verbatim}

View File

@ -1,102 +0,0 @@
\makeatletter
\def\PYG@reset{\let\PYG@it=\relax \let\PYG@bf=\relax%
\let\PYG@ul=\relax \let\PYG@tc=\relax%
\let\PYG@bc=\relax \let\PYG@ff=\relax}
\def\PYG@tok#1{\csname PYG@tok@#1\endcsname}
\def\PYG@toks#1+{\ifx\relax#1\empty\else%
\PYG@tok{#1}\expandafter\PYG@toks\fi}
\def\PYG@do#1{\PYG@bc{\PYG@tc{\PYG@ul{%
\PYG@it{\PYG@bf{\PYG@ff{#1}}}}}}}
\def\PYG#1#2{\PYG@reset\PYG@toks#1+\relax+\PYG@do{#2}}
\@namedef{PYG@tok@w}{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.73,0.73}{##1}}}
\@namedef{PYG@tok@c}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.24,0.48,0.48}{##1}}}
\@namedef{PYG@tok@cp}{\def\PYG@tc##1{\textcolor[rgb]{0.61,0.40,0.00}{##1}}}
\@namedef{PYG@tok@k}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PYG@tok@kp}{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PYG@tok@kt}{\def\PYG@tc##1{\textcolor[rgb]{0.69,0.00,0.25}{##1}}}
\@namedef{PYG@tok@o}{\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@ow}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}}
\@namedef{PYG@tok@nb}{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PYG@tok@nf}{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
\@namedef{PYG@tok@nc}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
\@namedef{PYG@tok@nn}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
\@namedef{PYG@tok@ne}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.80,0.25,0.22}{##1}}}
\@namedef{PYG@tok@nv}{\def\PYG@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\@namedef{PYG@tok@no}{\def\PYG@tc##1{\textcolor[rgb]{0.53,0.00,0.00}{##1}}}
\@namedef{PYG@tok@nl}{\def\PYG@tc##1{\textcolor[rgb]{0.46,0.46,0.00}{##1}}}
\@namedef{PYG@tok@ni}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.44,0.44,0.44}{##1}}}
\@namedef{PYG@tok@na}{\def\PYG@tc##1{\textcolor[rgb]{0.41,0.47,0.13}{##1}}}
\@namedef{PYG@tok@nt}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PYG@tok@nd}{\def\PYG@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}}
\@namedef{PYG@tok@s}{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PYG@tok@sd}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PYG@tok@si}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.64,0.35,0.47}{##1}}}
\@namedef{PYG@tok@se}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.67,0.36,0.12}{##1}}}
\@namedef{PYG@tok@sr}{\def\PYG@tc##1{\textcolor[rgb]{0.64,0.35,0.47}{##1}}}
\@namedef{PYG@tok@ss}{\def\PYG@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\@namedef{PYG@tok@sx}{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PYG@tok@m}{\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@gh}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}
\@namedef{PYG@tok@gu}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.50,0.00,0.50}{##1}}}
\@namedef{PYG@tok@gd}{\def\PYG@tc##1{\textcolor[rgb]{0.63,0.00,0.00}{##1}}}
\@namedef{PYG@tok@gi}{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.52,0.00}{##1}}}
\@namedef{PYG@tok@gr}{\def\PYG@tc##1{\textcolor[rgb]{0.89,0.00,0.00}{##1}}}
\@namedef{PYG@tok@ge}{\let\PYG@it=\textit}
\@namedef{PYG@tok@gs}{\let\PYG@bf=\textbf}
\@namedef{PYG@tok@ges}{\let\PYG@bf=\textbf\let\PYG@it=\textit}
\@namedef{PYG@tok@gp}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}
\@namedef{PYG@tok@go}{\def\PYG@tc##1{\textcolor[rgb]{0.44,0.44,0.44}{##1}}}
\@namedef{PYG@tok@gt}{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.27,0.87}{##1}}}
\@namedef{PYG@tok@err}{\def\PYG@bc##1{{\setlength{\fboxsep}{\string -\fboxrule}\fcolorbox[rgb]{1.00,0.00,0.00}{1,1,1}{\strut ##1}}}}
\@namedef{PYG@tok@kc}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PYG@tok@kd}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PYG@tok@kn}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PYG@tok@kr}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PYG@tok@bp}{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PYG@tok@fm}{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
\@namedef{PYG@tok@vc}{\def\PYG@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\@namedef{PYG@tok@vg}{\def\PYG@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\@namedef{PYG@tok@vi}{\def\PYG@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\@namedef{PYG@tok@vm}{\def\PYG@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\@namedef{PYG@tok@sa}{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PYG@tok@sb}{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PYG@tok@sc}{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PYG@tok@dl}{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PYG@tok@s2}{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PYG@tok@sh}{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PYG@tok@s1}{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PYG@tok@mb}{\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@mf}{\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@mh}{\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@mi}{\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@il}{\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@mo}{\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@ch}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.24,0.48,0.48}{##1}}}
\@namedef{PYG@tok@cm}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.24,0.48,0.48}{##1}}}
\@namedef{PYG@tok@cpf}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.24,0.48,0.48}{##1}}}
\@namedef{PYG@tok@c1}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.24,0.48,0.48}{##1}}}
\@namedef{PYG@tok@cs}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.24,0.48,0.48}{##1}}}
\def\PYGZbs{\char`\\}
\def\PYGZus{\char`\_}
\def\PYGZob{\char`\{}
\def\PYGZcb{\char`\}}
\def\PYGZca{\char`\^}
\def\PYGZam{\char`\&}
\def\PYGZlt{\char`\<}
\def\PYGZgt{\char`\>}
\def\PYGZsh{\char`\#}
\def\PYGZpc{\char`\%}
\def\PYGZdl{\char`\$}
\def\PYGZhy{\char`\-}
\def\PYGZsq{\char`\'}
\def\PYGZdq{\char`\"}
\def\PYGZti{\char`\~}
% for compatibility with earlier versions
\def\PYGZat{@}
\def\PYGZlb{[}
\def\PYGZrb{]}
\makeatother

View File

@ -1,11 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{+w}{ }\PYG{c+c1}{// test length function}
\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{traverse}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{start}\PYG{p}{)\PYGZob{}}
\PYG{+w}{ }\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{current}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{start}\PYG{p}{;}
\PYG{+w}{ }\PYG{k}{while}\PYG{p}{(}\PYG{n}{current}\PYG{+w}{ }\PYG{o}{!=}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{)\PYGZob{}}
\PYG{+w}{ }\PYG{n}{current}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{printFunction}\PYG{p}{(}\PYG{n}{current}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{data}\PYG{p}{);}
\PYG{+w}{ }\PYG{c+c1}{// printf("%s\n", current->data);}
\PYG{+w}{ }\PYG{n}{current}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{current}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{p}{;}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{p}{\PYGZcb{}}
\end{Verbatim}

View File

@ -1,81 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{c+cp}{\PYGZsh{}include}\PYG{+w}{ }\PYG{c+cpf}{\PYGZlt{}stdio.h\PYGZgt{}}
\PYG{c+cp}{\PYGZsh{}include}\PYG{+w}{ }\PYG{c+cpf}{\PYGZdq{}tests.h\PYGZdq{}}
\PYG{c+cp}{\PYGZsh{}include}\PYG{+w}{ }\PYG{c+cpf}{\PYGZdq{}genericLinkedList.h\PYGZdq{}}
\PYG{c+c1}{// functions to print out different data types}
\PYG{c+c1}{// a more professional design might be to put these in the genericLinkedList header file but i only need these for testing purposes}
\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{printChar}\PYG{p}{(}\PYG{k+kt}{void}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{data}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}\PYGZpc{}c}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{,}\PYG{+w}{ }\PYG{o}{*}\PYG{p}{(}\PYG{k+kt}{char}\PYG{o}{*}\PYG{p}{)}\PYG{+w}{ }\PYG{n}{data}\PYG{p}{);}
\PYG{p}{\PYGZcb{}}
\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{printStr}\PYG{p}{(}\PYG{k+kt}{void}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{data}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}\PYGZpc{}s}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{,}\PYG{+w}{ }\PYG{p}{(}\PYG{k+kt}{char}\PYG{o}{*}\PYG{p}{)}\PYG{+w}{ }\PYG{n}{data}\PYG{p}{);}
\PYG{p}{\PYGZcb{}}
\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{printInt}\PYG{p}{(}\PYG{k+kt}{void}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{data}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}\PYGZpc{}d}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{,}\PYG{+w}{ }\PYG{o}{*}\PYG{p}{(}\PYG{k+kt}{int}\PYG{o}{*}\PYG{p}{)}\PYG{+w}{ }\PYG{n}{data}\PYG{p}{);}
\PYG{p}{\PYGZcb{}}
\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{runTests}\PYG{p}{()\PYGZob{}}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Tests running...}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{l}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{createEl}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Test String (1).\PYGZdq{}}\PYG{p}{,}\PYG{+w}{ }\PYG{k}{sizeof}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Test String (1).\PYGZdq{}}\PYG{p}{),}\PYG{+w}{ }\PYG{n}{printStr}\PYG{p}{);}
\PYG{+w}{ }\PYG{c+c1}{//printf(\PYGZdq{}\PYGZpc{}s\PYGZbs{}n\PYGZpc{}p\PYGZbs{}n\PYGZdq{}, l\PYGZhy{}\PYGZgt{}data, l\PYGZhy{}\PYGZgt{}next);}
\PYG{+w}{ }\PYG{c+c1}{//Test create and traverse}
\PYG{+w}{ }\PYG{n}{traverse}\PYG{p}{(}\PYG{n}{l}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{c+c1}{//Test insert after}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Testing insertAfter()}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{l2}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{insertAfter}\PYG{p}{(}\PYG{n}{l}\PYG{p}{,}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}another string (2)\PYGZdq{}}\PYG{p}{,}\PYG{+w}{ }\PYG{k}{sizeof}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}another string (2)\PYGZdq{}}\PYG{p}{),}\PYG{+w}{ }\PYG{n}{printStr}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{insertAfter}\PYG{p}{(}\PYG{n}{l2}\PYG{p}{,}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}a final string (3)\PYGZdq{}}\PYG{p}{,}\PYG{+w}{ }\PYG{k}{sizeof}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}a final string (3)\PYGZdq{}}\PYG{p}{),}\PYG{+w}{ }\PYG{n}{printStr}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{traverse}\PYG{p}{(}\PYG{n}{l}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{c+c1}{// test length function}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Testing length()}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n}{l\PYGZus{}length}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{length}\PYG{p}{(}\PYG{n}{l}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}The length of l is \PYGZpc{}d}\PYG{l+s+se}{\PYGZbs{}n\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{l\PYGZus{}length}\PYG{p}{);}
\PYG{+w}{ }\PYG{c+c1}{// test push}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Testing push()}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{push}\PYG{p}{(}\PYG{o}{\PYGZam{}}\PYG{n}{l}\PYG{p}{,}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}yet another test string\PYGZdq{}}\PYG{p}{,}\PYG{+w}{ }\PYG{k}{sizeof}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}yet another test string\PYGZdq{}}\PYG{p}{),}\PYG{+w}{ }\PYG{n}{printStr}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{traverse}\PYG{p}{(}\PYG{n}{l}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}}\PYG{l+s+se}{\PYGZbs{}n\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{c+c1}{// test pop}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Testing pop()}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{popped}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{pop}\PYG{p}{(}\PYG{o}{\PYGZam{}}\PYG{n}{l}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{traverse}\PYG{p}{(}\PYG{n}{l}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}}\PYG{l+s+se}{\PYGZbs{}n\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{c+c1}{// Test delete after}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Testing deleteAfter()}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{deleteAfter}\PYG{p}{(}\PYG{n}{l}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{traverse}\PYG{p}{(}\PYG{n}{l}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{c+c1}{// test enqueue}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Testing enqueue()}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{enqueue}\PYG{p}{(}\PYG{o}{\PYGZam{}}\PYG{n}{l}\PYG{p}{,}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}enqueued test string\PYGZdq{}}\PYG{p}{,}\PYG{+w}{ }\PYG{k}{sizeof}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}enqueued test string\PYGZdq{}}\PYG{p}{),}\PYG{+w}{ }\PYG{n}{printStr}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{traverse}\PYG{p}{(}\PYG{n}{l}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{c+c1}{// test dequeue}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Testing dequeue()}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{dequeue}\PYG{p}{(}\PYG{n}{l}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{traverse}\PYG{p}{(}\PYG{n}{l}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Testing pushing different data types}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n}{myint}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{l+m+mi}{42}\PYG{p}{;}
\PYG{+w}{ }\PYG{n}{push}\PYG{p}{(}\PYG{o}{\PYGZam{}}\PYG{n}{l}\PYG{p}{,}\PYG{+w}{ }\PYG{o}{\PYGZam{}}\PYG{n}{myint}\PYG{p}{,}\PYG{+w}{ }\PYG{k}{sizeof}\PYG{p}{(}\PYG{n}{myint}\PYG{p}{),}\PYG{+w}{ }\PYG{n}{printInt}\PYG{p}{);}
\PYG{+w}{ }\PYG{k+kt}{char}\PYG{+w}{ }\PYG{n}{mychar}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{l+s+sc}{\PYGZsq{}c\PYGZsq{}}\PYG{p}{;}
\PYG{+w}{ }\PYG{n}{push}\PYG{p}{(}\PYG{o}{\PYGZam{}}\PYG{n}{l}\PYG{p}{,}\PYG{+w}{ }\PYG{o}{\PYGZam{}}\PYG{n}{mychar}\PYG{p}{,}\PYG{+w}{ }\PYG{k}{sizeof}\PYG{p}{(}\PYG{n}{mychar}\PYG{p}{),}\PYG{+w}{ }\PYG{n}{printChar}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{traverse}\PYG{p}{(}\PYG{n}{l}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}}\PYG{l+s+se}{\PYGZbs{}n\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{Tests complete.}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{p}{\PYGZcb{}}
\end{Verbatim}

View File

@ -1,38 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{+w}{ }\PYG{c+c1}{// test length function}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Testing length()}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n}{l\PYGZus{}length}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{length}\PYG{p}{(}\PYG{n}{l}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}The length of l is \PYGZpc{}d}\PYG{l+s+se}{\PYGZbs{}n\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{l\PYGZus{}length}\PYG{p}{);}
\PYG{+w}{ }\PYG{c+c1}{// test push}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Testing push()}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{push}\PYG{p}{(}\PYG{o}{\PYGZam{}}\PYG{n}{l}\PYG{p}{,}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}yet another test string\PYGZdq{}}\PYG{p}{,}\PYG{+w}{ }\PYG{k}{sizeof}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}yet another test string\PYGZdq{}}\PYG{p}{));}
\PYG{+w}{ }\PYG{n}{traverse}\PYG{p}{(}\PYG{n}{l}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}}\PYG{l+s+se}{\PYGZbs{}n\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{c+c1}{// test pop}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Testing pop()}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{popped}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{pop}\PYG{p}{(}\PYG{o}{\PYGZam{}}\PYG{n}{l}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{traverse}\PYG{p}{(}\PYG{n}{l}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}}\PYG{l+s+se}{\PYGZbs{}n\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{c+c1}{// Test delete after}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Testing deleteAfter()}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{deleteAfter}\PYG{p}{(}\PYG{n}{l}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{traverse}\PYG{p}{(}\PYG{n}{l}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{c+c1}{// test enqueue}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Testing enqueue()}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{enqueue}\PYG{p}{(}\PYG{o}{\PYGZam{}}\PYG{n}{l}\PYG{p}{,}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}enqueued test string\PYGZdq{}}\PYG{p}{,}\PYG{+w}{ }\PYG{k}{sizeof}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}enqueued test string\PYGZdq{}}\PYG{p}{));}
\PYG{+w}{ }\PYG{n}{traverse}\PYG{p}{(}\PYG{n}{l}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{c+c1}{// test dequeue}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Testing dequeue()}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{dequeue}\PYG{p}{(}\PYG{n}{l}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{traverse}\PYG{p}{(}\PYG{n}{l}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{Tests complete.}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\end{Verbatim}

View File

@ -1,37 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{c+cp}{\PYGZsh{}ifndef CT331\PYGZus{}ASSIGNMENT\PYGZus{}LINKED\PYGZus{}LIST}
\PYG{c+cp}{\PYGZsh{}define CT331\PYGZus{}ASSIGNMENT\PYGZus{}LINKED\PYGZus{}LIST}
\PYG{k}{typedef}\PYG{+w}{ }\PYG{k}{struct}\PYG{+w}{ }\PYG{n+nc}{listElementStruct}\PYG{+w}{ }\PYG{n}{listElement}\PYG{p}{;}
\PYG{c+c1}{//Creates a new linked list element with given content of size}
\PYG{c+c1}{//Returns a pointer to the element}
\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n+nf}{createEl}\PYG{p}{(}\PYG{k+kt}{void}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{data}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{size\PYGZus{}t}\PYG{+w}{ }\PYG{n}{size}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{+w}{ }\PYG{p}{(}\PYG{o}{*}\PYG{n}{printFunction}\PYG{p}{)(}\PYG{k+kt}{void}\PYG{o}{*}\PYG{p}{));}
\PYG{c+c1}{//Prints out each element in the list}
\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{traverse}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{start}\PYG{p}{);}
\PYG{c+c1}{//Inserts a new element after the given el}
\PYG{c+c1}{//Returns the pointer to the new element}
\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n+nf}{insertAfter}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{after}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{data}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{size\PYGZus{}t}\PYG{+w}{ }\PYG{n}{size}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{+w}{ }\PYG{p}{(}\PYG{o}{*}\PYG{n}{printFunction}\PYG{p}{)(}\PYG{k+kt}{void}\PYG{o}{*}\PYG{p}{));}
\PYG{c+c1}{//Delete the element after the given el}
\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{deleteAfter}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{after}\PYG{p}{);}
\PYG{c+c1}{// returns the number of elements in the list}
\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n+nf}{length}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{);}
\PYG{c+c1}{// push a new element onto the head of a list and update the list reference using side effects}
\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{push}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{**}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{data}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{size\PYGZus{}t}\PYG{+w}{ }\PYG{n}{size}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{+w}{ }\PYG{p}{(}\PYG{o}{*}\PYG{n}{printFunction}\PYG{p}{)(}\PYG{k+kt}{void}\PYG{o}{*}\PYG{p}{));}
\PYG{c+c1}{// pop an element from the head of a list and update the list reference using side effects}
\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n+nf}{pop}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{**}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{);}
\PYG{c+c1}{// enque a new element onto the head of the list and update the list reference using side effects}
\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{enqueue}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{**}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{data}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{size\PYGZus{}t}\PYG{+w}{ }\PYG{n}{size}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{+w}{ }\PYG{p}{(}\PYG{o}{*}\PYG{n}{printFunction}\PYG{p}{)(}\PYG{k+kt}{void}\PYG{o}{*}\PYG{p}{));}\PYG{+w}{ }
\PYG{c+c1}{// dequeue an element from the tail of the list }
\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n+nf}{dequeue}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{);}\PYG{+w}{ }
\PYG{c+cp}{\PYGZsh{}endif}
\end{Verbatim}

View File

@ -1,37 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{c+cp}{\PYGZsh{}ifndef CT331_ASSIGNMENT_LINKED_LIST}
\PYG{c+cp}{#define CT331_ASSIGNMENT_LINKED_LIST}
\PYG{k}{typedef}\PYG{+w}{ }\PYG{k}{struct}\PYG{+w}{ }\PYG{n+nc}{listElementStruct}\PYG{+w}{ }\PYG{n}{listElement}\PYG{p}{;}
\PYG{c+c1}{//Creates a new linked list element with given content of size}
\PYG{c+c1}{//Returns a pointer to the element}
\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n+nf}{createEl}\PYG{p}{(}\PYG{k+kt}{void}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{data}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{size\PYGZus{}t}\PYG{+w}{ }\PYG{n}{size}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{+w}{ }\PYG{p}{(}\PYG{o}{*}\PYG{n}{printFunction}\PYG{p}{)(}\PYG{k+kt}{void}\PYG{o}{*}\PYG{p}{));}
\PYG{c+c1}{//Prints out each element in the list}
\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{traverse}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{start}\PYG{p}{);}
\PYG{c+c1}{//Inserts a new element after the given el}
\PYG{c+c1}{//Returns the pointer to the new element}
\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n+nf}{insertAfter}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{after}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{data}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{size\PYGZus{}t}\PYG{+w}{ }\PYG{n}{size}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{+w}{ }\PYG{p}{(}\PYG{o}{*}\PYG{n}{printFunction}\PYG{p}{)(}\PYG{k+kt}{void}\PYG{o}{*}\PYG{p}{));}
\PYG{c+c1}{//Delete the element after the given el}
\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{deleteAfter}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{after}\PYG{p}{);}
\PYG{c+c1}{// returns the number of elements in the list}
\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n+nf}{length}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{);}
\PYG{c+c1}{// push a new element onto the head of a list and update the list reference using side effects}
\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{push}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{**}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{data}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{size\PYGZus{}t}\PYG{+w}{ }\PYG{n}{size}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{+w}{ }\PYG{p}{(}\PYG{o}{*}\PYG{n}{printFunction}\PYG{p}{)(}\PYG{k+kt}{void}\PYG{o}{*}\PYG{p}{));}
\PYG{c+c1}{// pop an element from the head of a list and update the list reference using side effects}
\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n+nf}{pop}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{**}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{);}
\PYG{c+c1}{// enque a new element onto the head of the list and update the list reference using side effects}
\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{enqueue}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{**}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{data}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{size\PYGZus{}t}\PYG{+w}{ }\PYG{n}{size}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{+w}{ }\PYG{p}{(}\PYG{o}{*}\PYG{n}{printFunction}\PYG{p}{)(}\PYG{k+kt}{void}\PYG{o}{*}\PYG{p}{));}\PYG{+w}{ }
\PYG{c+c1}{// dequeue an element from the tail of the list }
\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n+nf}{dequeue}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{);}\PYG{+w}{ }
\PYG{c+cp}{\PYGZsh{}endif}
\end{Verbatim}

View File

@ -1,3 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\end{Verbatim}

View File

@ -1,16 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{c+c1}{// returns the number of elements in the list}
\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n+nf}{length}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{);}
\PYG{c+c1}{// push a new element onto the head of a list and update the list reference using side effects}
\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{push}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{**}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{char}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{data}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{size\PYGZus{}t}\PYG{+w}{ }\PYG{n}{size}\PYG{p}{);}
\PYG{c+c1}{// pop an element from the head of a list and update the list reference using side effects}
\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n+nf}{pop}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{**}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{);}
\PYG{c+c1}{// enque a new element onto the head of the list and update the list reference using side effects}
\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{enqueue}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{**}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{char}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{data}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{size\PYGZus{}t}\PYG{+w}{ }\PYG{n}{size}\PYG{p}{);}
\PYG{c+c1}{// dequeue an element from the tail of the list}
\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n+nf}{dequeue}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{);}
\end{Verbatim}

View File

@ -1,103 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{c+c1}{// returns the number of elements in the list}
\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n+nf}{length}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n}{length}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{l+m+mi}{0}\PYG{p}{;}
\PYG{+w}{ }\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{current}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{;}
\PYG{+w}{ }\PYG{c+c1}{// traversing the list and counting each element}
\PYG{+w}{ }\PYG{k}{while}\PYG{p}{(}\PYG{n}{current}\PYG{+w}{ }\PYG{o}{!=}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{)\PYGZob{}}
\PYG{+w}{ }\PYG{n}{length}\PYG{o}{++}\PYG{p}{;}
\PYG{+w}{ }\PYG{n}{current}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{current}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{p}{;}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{n}{length}\PYG{p}{;}
\PYG{p}{\PYGZcb{}}
\PYG{c+c1}{// push a new element onto the head of a list and update the list reference using side effects}
\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{push}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{**}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{char}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{data}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{size\PYGZus{}t}\PYG{+w}{ }\PYG{n}{size}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// create the new element}
\PYG{+w}{ }\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{newElement}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{createEl}\PYG{p}{(}\PYG{n}{data}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{size}\PYG{p}{);}
\PYG{+w}{ }\PYG{c+c1}{// handle malloc errors}
\PYG{+w}{ }\PYG{k}{if}\PYG{+w}{ }\PYG{p}{(}\PYG{n}{newElement}\PYG{+w}{ }\PYG{o}{==}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{fprintf}\PYG{p}{(}\PYG{n}{stderr}\PYG{p}{,}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}Memory allocation failed.}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{exit}\PYG{p}{(}\PYG{n}{EXIT\PYGZus{}FAILURE}\PYG{p}{);}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{c+c1}{// make the the new element point to the current head of the list}
\PYG{+w}{ }\PYG{n}{newElement}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{o}{*}\PYG{n}{list}\PYG{p}{;}
\PYG{+w}{ }\PYG{c+c1}{// make the list reference to point to the new head element}
\PYG{+w}{ }\PYG{o}{*}\PYG{n}{list}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{newElement}\PYG{p}{;}
\PYG{p}{\PYGZcb{}}
\PYG{c+c1}{// pop an element from the head of a list and update the list reference using side effects}
\PYG{c+c1}{// assuming that the desired return value here is the popped element, as is standard for POP operations}
\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n+nf}{pop}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{**}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// don't bother if list is non existent}
\PYG{+w}{ }\PYG{k}{if}\PYG{+w}{ }\PYG{p}{(}\PYG{o}{*}\PYG{n}{list}\PYG{+w}{ }\PYG{o}{==}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{;}\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{p}{;}
\PYG{+w}{ }\PYG{c+c1}{// getting reference to the element to be popped}
\PYG{+w}{ }\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{poppedElement}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{o}{*}\PYG{n}{list}\PYG{p}{;}
\PYG{+w}{ }\PYG{c+c1}{// make the the second element the new head of the list -- this could be NULL, so the list would be NULL also}
\PYG{+w}{ }\PYG{o}{*}\PYG{n}{list}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{p}{(}\PYG{o}{*}\PYG{n}{list}\PYG{p}{)}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{p}{;}
\PYG{+w}{ }\PYG{c+c1}{// detach the popped element from the list}
\PYG{+w}{ }\PYG{n}{poppedElement}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{;}
\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{n}{poppedElement}\PYG{p}{;}
\PYG{p}{\PYGZcb{}}
\PYG{c+c1}{// enque a new element onto the head of the list and update the list reference using side effects}
\PYG{c+c1}{// essentially the same as push}
\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{enqueue}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{**}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{char}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{data}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{size\PYGZus{}t}\PYG{+w}{ }\PYG{n}{size}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// create the new element}
\PYG{+w}{ }\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{newElement}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{createEl}\PYG{p}{(}\PYG{n}{data}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{size}\PYG{p}{);}
\PYG{+w}{ }\PYG{c+c1}{// handle malloc errors}
\PYG{+w}{ }\PYG{k}{if}\PYG{+w}{ }\PYG{p}{(}\PYG{n}{newElement}\PYG{+w}{ }\PYG{o}{==}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{fprintf}\PYG{p}{(}\PYG{n}{stderr}\PYG{p}{,}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}Memory allocation failed.}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{exit}\PYG{p}{(}\PYG{n}{EXIT\PYGZus{}FAILURE}\PYG{p}{);}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{c+c1}{// make the the new element point to the current head of the list}
\PYG{+w}{ }\PYG{n}{newElement}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{o}{*}\PYG{n}{list}\PYG{p}{;}
\PYG{+w}{ }\PYG{c+c1}{// make the list reference to point to the new head element}
\PYG{+w}{ }\PYG{o}{*}\PYG{n}{list}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{newElement}\PYG{p}{;}
\PYG{p}{\PYGZcb{}}
\PYG{c+c1}{// dequeue an element from the tail of the list by removing the element from the list via side effects, and returning the removed item}
\PYG{c+c1}{// assuming that we want to return the dequeued element rather than the list itself, as enqueue returns nothing and uses side effects, so dequeue should also use side effects}
\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n+nf}{dequeue}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// there are three cases that we must consider: a list with 0 elements, a list with 1 element, & a list with >=2 elements}
\PYG{+w}{ }\PYG{c+c1}{// don't bother if list is non existent}
\PYG{+w}{ }\PYG{k}{if}\PYG{+w}{ }\PYG{p}{(}\PYG{n}{list}\PYG{+w}{ }\PYG{o}{==}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{;}\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{c+c1}{// if there is only one element in the list, i.e. the head element is also the tail element, just returning this element}
\PYG{+w}{ }\PYG{c+c1}{// this means that the listElement pointer that was passed to this function won't be updated}
\PYG{+w}{ }\PYG{c+c1}{// ideally, we would set it to NULL but we can't do that since `list` is a pointer that has been passed by value, so we can't update the pointer itself. we would need a pointer to a pointer to have been passed}
\PYG{+w}{ }\PYG{k}{if}\PYG{+w}{ }\PYG{p}{(}\PYG{n}{list}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{+w}{ }\PYG{o}{==}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{;}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{c+c1}{// traversing the list to find the second-to-last element}
\PYG{+w}{ }\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{current}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{;}
\PYG{+w}{ }\PYG{k}{while}\PYG{+w}{ }\PYG{p}{(}\PYG{n}{current}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{+w}{ }\PYG{o}{!=}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{current}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{current}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{p}{;}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{c+c1}{// get reference to the element to be dequeued}
\PYG{+w}{ }\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{dequeuedElement}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{current}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{p}{;}
\PYG{+w}{ }\PYG{c+c1}{// make the penultimate element the tail by removing reference to the old tail}
\PYG{+w}{ }\PYG{n}{current}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{;}
\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{;}
\PYG{p}{\PYGZcb{}}
\end{Verbatim}

View File

@ -1,169 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{c+cp}{\PYGZsh{}include}\PYG{+w}{ }\PYG{c+cpf}{\PYGZlt{}stdio.h\PYGZgt{}}
\PYG{c+cp}{\PYGZsh{}include}\PYG{+w}{ }\PYG{c+cpf}{\PYGZlt{}stdlib.h\PYGZgt{}}
\PYG{c+cp}{\PYGZsh{}include}\PYG{+w}{ }\PYG{c+cpf}{\PYGZlt{}string.h\PYGZgt{}}
\PYG{c+cp}{\PYGZsh{}include}\PYG{+w}{ }\PYG{c+cpf}{\PYGZdq{}genericLinkedList.h\PYGZdq{}}
\PYG{k}{typedef}\PYG{+w}{ }\PYG{k}{struct}\PYG{+w}{ }\PYG{n+nc}{listElementStruct}\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{k+kt}{void}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{data}\PYG{p}{;}
\PYG{+w}{ }\PYG{k+kt}{void}\PYG{+w}{ }\PYG{p}{(}\PYG{o}{*}\PYG{n}{printFunction}\PYG{p}{)(}\PYG{k+kt}{void}\PYG{o}{*}\PYG{p}{);}
\PYG{+w}{ }\PYG{k+kt}{size\PYGZus{}t}\PYG{+w}{ }\PYG{n}{size}\PYG{p}{;}
\PYG{+w}{ }\PYG{k}{struct}\PYG{+w}{ }\PYG{n+nc}{listElementStruct}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{next}\PYG{p}{;}
\PYG{p}{\PYGZcb{}}\PYG{+w}{ }\PYG{n}{listElement}\PYG{p}{;}
\PYG{c+c1}{//Creates a new linked list element with given content of size}
\PYG{c+c1}{//Returns a pointer to the element}
\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n+nf}{createEl}\PYG{p}{(}\PYG{k+kt}{void}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{data}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{size\PYGZus{}t}\PYG{+w}{ }\PYG{n}{size}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{+w}{ }\PYG{p}{(}\PYG{o}{*}\PYG{n}{printFunction}\PYG{p}{)(}\PYG{k+kt}{void}\PYG{o}{*}\PYG{p}{))}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{e}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{malloc}\PYG{p}{(}\PYG{k}{sizeof}\PYG{p}{(}\PYG{n}{listElement}\PYG{p}{));}
\PYG{+w}{ }\PYG{k}{if}\PYG{p}{(}\PYG{n}{e}\PYG{+w}{ }\PYG{o}{==}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{)\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{//malloc has had an error}
\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{;}\PYG{+w}{ }\PYG{c+c1}{//return NULL to indicate an error.}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{k+kt}{void}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{dataPointer}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{malloc}\PYG{p}{(}\PYG{k}{sizeof}\PYG{p}{(}\PYG{k+kt}{void}\PYG{p}{)}\PYG{o}{*}\PYG{n}{size}\PYG{p}{);}
\PYG{+w}{ }\PYG{k}{if}\PYG{p}{(}\PYG{n}{dataPointer}\PYG{+w}{ }\PYG{o}{==}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{)\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{//malloc has had an error}
\PYG{+w}{ }\PYG{n}{free}\PYG{p}{(}\PYG{n}{e}\PYG{p}{);}\PYG{+w}{ }\PYG{c+c1}{//release the previously allocated memory}
\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{;}\PYG{+w}{ }\PYG{c+c1}{//return NULL to indicate an error.}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{n}{strcpy}\PYG{p}{(}\PYG{n}{dataPointer}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{data}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{e}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{data}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{dataPointer}\PYG{p}{;}
\PYG{+w}{ }\PYG{n}{e}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{printFunction}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{printFunction}\PYG{p}{;}
\PYG{+w}{ }\PYG{n}{e}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{size}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{size}\PYG{p}{;}
\PYG{+w}{ }\PYG{n}{e}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{;}
\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{n}{e}\PYG{p}{;}
\PYG{p}{\PYGZcb{}}
\PYG{c+c1}{//Prints out each element in the list}
\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{traverse}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{start}\PYG{p}{)\PYGZob{}}
\PYG{+w}{ }\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{current}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{start}\PYG{p}{;}
\PYG{+w}{ }\PYG{k}{while}\PYG{p}{(}\PYG{n}{current}\PYG{+w}{ }\PYG{o}{!=}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{)\PYGZob{}}
\PYG{+w}{ }\PYG{n}{current}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{printFunction}\PYG{p}{(}\PYG{n}{current}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{data}\PYG{p}{);}
\PYG{+w}{ }\PYG{c+c1}{// printf(\PYGZdq{}\PYGZpc{}s\PYGZbs{}n\PYGZdq{}, current\PYGZhy{}\PYGZgt{}data);}
\PYG{+w}{ }\PYG{n}{current}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{current}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{p}{;}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{p}{\PYGZcb{}}
\PYG{c+c1}{//Inserts a new element after the given el}
\PYG{c+c1}{//Returns the pointer to the new element}
\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n+nf}{insertAfter}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{el}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{data}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{size\PYGZus{}t}\PYG{+w}{ }\PYG{n}{size}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{+w}{ }\PYG{p}{(}\PYG{o}{*}\PYG{n}{printFunction}\PYG{p}{)(}\PYG{k+kt}{void}\PYG{o}{*}\PYG{p}{))\PYGZob{}}
\PYG{+w}{ }\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{newEl}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{createEl}\PYG{p}{(}\PYG{n}{data}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{size}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{printFunction}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{next}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{el}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{p}{;}
\PYG{+w}{ }\PYG{n}{newEl}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{next}\PYG{p}{;}
\PYG{+w}{ }\PYG{n}{el}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{newEl}\PYG{p}{;}
\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{n}{newEl}\PYG{p}{;}
\PYG{p}{\PYGZcb{}}
\PYG{c+c1}{//Delete the element after the given el}
\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{deleteAfter}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{after}\PYG{p}{)\PYGZob{}}
\PYG{+w}{ }\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{delete}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{after}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{p}{;}
\PYG{+w}{ }\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{newNext}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{delete}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{p}{;}
\PYG{+w}{ }\PYG{n}{after}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{newNext}\PYG{p}{;}
\PYG{+w}{ }\PYG{c+c1}{//need to free the memory because we used malloc}
\PYG{+w}{ }\PYG{n}{free}\PYG{p}{(}\PYG{n}{delete}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{data}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{free}\PYG{p}{(}\PYG{n}{delete}\PYG{p}{);}
\PYG{p}{\PYGZcb{}}
\PYG{c+c1}{// returns the number of elements in the list}
\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n+nf}{length}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n}{length}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{l+m+mi}{0}\PYG{p}{;}
\PYG{+w}{ }\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{current}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{;}
\PYG{+w}{ }\PYG{c+c1}{// traversing the list and counting each element}
\PYG{+w}{ }\PYG{k}{while}\PYG{p}{(}\PYG{n}{current}\PYG{+w}{ }\PYG{o}{!=}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{)\PYGZob{}}
\PYG{+w}{ }\PYG{n}{length}\PYG{o}{++}\PYG{p}{;}
\PYG{+w}{ }\PYG{n}{current}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{current}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{p}{;}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{n}{length}\PYG{p}{;}
\PYG{p}{\PYGZcb{}}
\PYG{c+c1}{// push a new element onto the head of a list and update the list reference using side effects}
\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{push}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{**}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{data}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{size\PYGZus{}t}\PYG{+w}{ }\PYG{n}{size}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{+w}{ }\PYG{p}{(}\PYG{o}{*}\PYG{n}{printFunction}\PYG{p}{)(}\PYG{k+kt}{void}\PYG{o}{*}\PYG{p}{))}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// create the new element}
\PYG{+w}{ }\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{newElement}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{createEl}\PYG{p}{(}\PYG{n}{data}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{size}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{printFunction}\PYG{p}{);}
\PYG{+w}{ }\PYG{c+c1}{// handle malloc errors}
\PYG{+w}{ }\PYG{k}{if}\PYG{+w}{ }\PYG{p}{(}\PYG{n}{newElement}\PYG{+w}{ }\PYG{o}{==}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{fprintf}\PYG{p}{(}\PYG{n}{stderr}\PYG{p}{,}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}Memory allocation failed.}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{exit}\PYG{p}{(}\PYG{n}{EXIT\PYGZus{}FAILURE}\PYG{p}{);}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{c+c1}{// make the the new element point to the current head of the list}
\PYG{+w}{ }\PYG{n}{newElement}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{o}{*}\PYG{n}{list}\PYG{p}{;}
\PYG{+w}{ }\PYG{c+c1}{// make the list reference to point to the new head element }
\PYG{+w}{ }\PYG{o}{*}\PYG{n}{list}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{newElement}\PYG{p}{;}
\PYG{p}{\PYGZcb{}}
\PYG{c+c1}{// pop an element from the head of a list and update the list reference using side effects}
\PYG{c+c1}{// assuming that the desired return value here is the popped element, as is standard for POP operations}
\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n+nf}{pop}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{**}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// don\PYGZsq{}t bother if list is non existent}
\PYG{+w}{ }\PYG{k}{if}\PYG{+w}{ }\PYG{p}{(}\PYG{o}{*}\PYG{n}{list}\PYG{+w}{ }\PYG{o}{==}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{;}\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{p}{;}\PYG{+w}{ }
\PYG{+w}{ }\PYG{c+c1}{// getting reference to the element to be popped}
\PYG{+w}{ }\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{poppedElement}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{o}{*}\PYG{n}{list}\PYG{p}{;}
\PYG{+w}{ }\PYG{c+c1}{// make the the second element the new head of the list \PYGZhy{}\PYGZhy{} this could be NULL, so the list would be NULL also}
\PYG{+w}{ }\PYG{o}{*}\PYG{n}{list}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{p}{(}\PYG{o}{*}\PYG{n}{list}\PYG{p}{)}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{p}{;}
\PYG{+w}{ }\PYG{c+c1}{// detach the popped element from the list}
\PYG{+w}{ }\PYG{n}{poppedElement}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{;}
\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{n}{poppedElement}\PYG{p}{;}
\PYG{p}{\PYGZcb{}}
\PYG{c+c1}{// enque a new element onto the head of the list and update the list reference using side effects}
\PYG{c+c1}{// essentially the same as push}
\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{enqueue}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{**}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{data}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{size\PYGZus{}t}\PYG{+w}{ }\PYG{n}{size}\PYG{p}{,}\PYG{+w}{ }\PYG{k+kt}{void}\PYG{+w}{ }\PYG{p}{(}\PYG{o}{*}\PYG{n}{printFunction}\PYG{p}{)(}\PYG{k+kt}{void}\PYG{o}{*}\PYG{p}{))}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// create the new element}
\PYG{+w}{ }\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{newElement}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{createEl}\PYG{p}{(}\PYG{n}{data}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{size}\PYG{p}{,}\PYG{+w}{ }\PYG{n}{printFunction}\PYG{p}{);}
\PYG{+w}{ }\PYG{c+c1}{// handle malloc errors}
\PYG{+w}{ }\PYG{k}{if}\PYG{+w}{ }\PYG{p}{(}\PYG{n}{newElement}\PYG{+w}{ }\PYG{o}{==}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{fprintf}\PYG{p}{(}\PYG{n}{stderr}\PYG{p}{,}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}Memory allocation failed.}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{exit}\PYG{p}{(}\PYG{n}{EXIT\PYGZus{}FAILURE}\PYG{p}{);}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{c+c1}{// make the the new element point to the current head of the list}
\PYG{+w}{ }\PYG{n}{newElement}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{o}{*}\PYG{n}{list}\PYG{p}{;}
\PYG{+w}{ }\PYG{c+c1}{// make the list reference to point to the new head element }
\PYG{+w}{ }\PYG{o}{*}\PYG{n}{list}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{newElement}\PYG{p}{;}
\PYG{p}{\PYGZcb{}}\PYG{+w}{ }
\PYG{c+c1}{// dequeue an element from the tail of the list by removing the element from the list via side effects, and returning the removed item}
\PYG{c+c1}{// assuming that we want to return the dequeued element rather than the list itself, as enqueue returns nothing and uses side effects, so dequeue should also use side effects}
\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n+nf}{dequeue}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{c+c1}{// there are three cases that we must consider: a list with 0 elements, a list with 1 element, \PYGZam{} a list with \PYGZgt{}=2 elements}
\PYG{+w}{ }\PYG{c+c1}{// don\PYGZsq{}t bother if list is non existent}
\PYG{+w}{ }\PYG{k}{if}\PYG{+w}{ }\PYG{p}{(}\PYG{n}{list}\PYG{+w}{ }\PYG{o}{==}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{;}\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{c+c1}{// if there is only one element in the list, i.e. the head element is also the tail element, just returning this element}
\PYG{+w}{ }\PYG{c+c1}{// this means that the listElement pointer that was passed to this function won\PYGZsq{}t be updated}
\PYG{+w}{ }\PYG{c+c1}{// ideally, we would set it to NULL but we can\PYGZsq{}t do that since `list` is a pointer that has been passed by value, so we can\PYGZsq{}t update the pointer itself. we would need a pointer to a pointer to have been passed }
\PYG{+w}{ }\PYG{k}{if}\PYG{+w}{ }\PYG{p}{(}\PYG{n}{list}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{+w}{ }\PYG{o}{==}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{;}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{c+c1}{// traversing the list to find the second\PYGZhy{}to\PYGZhy{}last element}
\PYG{+w}{ }\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{current}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{;}
\PYG{+w}{ }\PYG{k}{while}\PYG{+w}{ }\PYG{p}{(}\PYG{n}{current}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{+w}{ }\PYG{o}{!=}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{current}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{current}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{p}{;}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{c+c1}{// get reference to the element to be dequeued}
\PYG{+w}{ }\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{dequeuedElement}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{current}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{p}{;}
\PYG{+w}{ }\PYG{c+c1}{// make the penultimate element the tail by removing reference to the old tail}
\PYG{+w}{ }\PYG{n}{current}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{;}
\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{n}{list}\PYG{p}{;}
\PYG{p}{\PYGZcb{}}
\end{Verbatim}

View File

@ -1,17 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{c+cp}{\PYGZsh{}include}\PYG{+w}{ }\PYG{c+cpf}{\PYGZlt{}stdio.h>}
\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n+nf}{main}\PYG{p}{()}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{k+kt}{int}\PYG{+w}{ }\PYG{n}{my\PYGZus{}int}\PYG{p}{;}
\PYG{+w}{ }\PYG{k+kt}{int}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{my\PYGZus{}int\PYGZus{}pointer}\PYG{p}{;}
\PYG{+w}{ }\PYG{k+kt}{long}\PYG{+w}{ }\PYG{n}{my\PYGZus{}long}\PYG{p}{;}
\PYG{+w}{ }\PYG{k+kt}{double}\PYG{+w}{ }\PYG{o}{*}\PYG{+w}{ }\PYG{n}{my\PYGZus{}double\PYGZus{}pointer}\PYG{p}{;}
\PYG{+w}{ }\PYG{k+kt}{char}\PYG{+w}{ }\PYG{o}{**}\PYG{+w}{ }\PYG{n}{my\PYGZus{}char\PYGZus{}pointer\PYGZus{}pointer}\PYG{p}{;}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}The size of my\PYGZus{}int is \PYGZpc{}lu bytes}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{,}\PYG{+w}{ }\PYG{k}{sizeof}\PYG{p}{(}\PYG{n}{my\PYGZus{}int}\PYG{p}{));}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}The size of my\PYGZus{}int\PYGZus{}pointer is \PYGZpc{}lu bytes}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{,}\PYG{+w}{ }\PYG{k}{sizeof}\PYG{p}{(}\PYG{n}{my\PYGZus{}int\PYGZus{}pointer}\PYG{p}{));}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}The size of my\PYGZus{}long is \PYGZpc{}lu bytes}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{,}\PYG{+w}{ }\PYG{k}{sizeof}\PYG{p}{(}\PYG{n}{my\PYGZus{}long}\PYG{p}{));}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}The size of my\PYGZus{}double\PYGZus{}pointer is \PYGZpc{}lu bytes}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{,}\PYG{+w}{ }\PYG{k}{sizeof}\PYG{p}{(}\PYG{n}{my\PYGZus{}double\PYGZus{}pointer}\PYG{p}{));}
\PYG{+w}{ }\PYG{n}{printf}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}The size of my\PYGZus{}char\PYGZus{}pointer\PYGZus{}pointer is \PYGZpc{}lu bytes}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s}{\PYGZdq{}}\PYG{p}{,}\PYG{+w}{ }\PYG{k}{sizeof}\PYG{p}{(}\PYG{n}{my\PYGZus{}char\PYGZus{}pointer\PYGZus{}pointer}\PYG{p}{));}
\PYG{p}{\PYGZcb{}}
\end{Verbatim}

View File

@ -1,10 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{traverse}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{start}\PYG{p}{)\PYGZob{}}
\PYG{+w}{ }\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{current}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{start}\PYG{p}{;}
\PYG{+w}{ }\PYG{k}{while}\PYG{p}{(}\PYG{n}{current}\PYG{+w}{ }\PYG{o}{!=}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{)\PYGZob{}}
\PYG{+w}{ }\PYG{n}{current}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{printFunction}\PYG{p}{(}\PYG{n}{current}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{data}\PYG{p}{);}
\PYG{+w}{ }\PYG{c+c1}{// printf(\PYGZdq{}\PYGZpc{}s\PYGZbs{}n\PYGZdq{}, current\PYGZhy{}\PYGZgt{}data);}
\PYG{+w}{ }\PYG{n}{current}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{current}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{p}{;}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{p}{\PYGZcb{}}
\end{Verbatim}

View File

@ -1,10 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{traverse}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{start}\PYG{p}{)\PYGZob{}}
\PYG{+w}{ }\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{current}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{start}\PYG{p}{;}
\PYG{+w}{ }\PYG{k}{while}\PYG{p}{(}\PYG{n}{current}\PYG{+w}{ }\PYG{o}{!=}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{)\PYGZob{}}
\PYG{+w}{ }\PYG{n}{current}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{printFunction}\PYG{p}{(}\PYG{n}{current}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{data}\PYG{p}{);}
\PYG{+w}{ }\PYG{c+c1}{// printf("%s\n", current->data);}
\PYG{+w}{ }\PYG{n}{current}\PYG{+w}{ }\PYG{o}{=}\PYG{+w}{ }\PYG{n}{current}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{p}{;}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{p}{\PYGZcb{}}
\end{Verbatim}

View File

@ -1,7 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{k+kt}{void}\PYG{+w}{ }\PYG{n+nf}{reverse\PYGZus{}traverse}\PYG{p}{(}\PYG{n}{listElement}\PYG{o}{*}\PYG{+w}{ }\PYG{n}{current}\PYG{p}{)\PYGZob{}}
\PYG{+w}{ }\PYG{k}{if}\PYG{+w}{ }\PYG{p}{(}\PYG{n}{current}\PYG{+w}{ }\PYG{o}{==}\PYG{+w}{ }\PYG{n+nb}{NULL}\PYG{p}{)}\PYG{+w}{ }\PYG{p}{\PYGZob{}}\PYG{+w}{ }\PYG{k}{return}\PYG{p}{;}\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{+w}{ }\PYG{n}{reverse\PYGZus{}traverse}\PYG{p}{(}\PYG{n}{current}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{next}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{current}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{printFunction}\PYG{p}{(}\PYG{n}{current}\PYG{o}{\PYGZhy{}\PYGZgt{}}\PYG{n}{data}\PYG{p}{);}
\PYG{p}{\PYGZcb{}}
\end{Verbatim}

View File

@ -1,102 +0,0 @@
\makeatletter
\def\PYG@reset{\let\PYG@it=\relax \let\PYG@bf=\relax%
\let\PYG@ul=\relax \let\PYG@tc=\relax%
\let\PYG@bc=\relax \let\PYG@ff=\relax}
\def\PYG@tok#1{\csname PYG@tok@#1\endcsname}
\def\PYG@toks#1+{\ifx\relax#1\empty\else%
\PYG@tok{#1}\expandafter\PYG@toks\fi}
\def\PYG@do#1{\PYG@bc{\PYG@tc{\PYG@ul{%
\PYG@it{\PYG@bf{\PYG@ff{#1}}}}}}}
\def\PYG#1#2{\PYG@reset\PYG@toks#1+\relax+\PYG@do{#2}}
\@namedef{PYG@tok@w}{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.73,0.73}{##1}}}
\@namedef{PYG@tok@c}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.24,0.48,0.48}{##1}}}
\@namedef{PYG@tok@cp}{\def\PYG@tc##1{\textcolor[rgb]{0.61,0.40,0.00}{##1}}}
\@namedef{PYG@tok@k}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PYG@tok@kp}{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PYG@tok@kt}{\def\PYG@tc##1{\textcolor[rgb]{0.69,0.00,0.25}{##1}}}
\@namedef{PYG@tok@o}{\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@ow}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}}
\@namedef{PYG@tok@nb}{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PYG@tok@nf}{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
\@namedef{PYG@tok@nc}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
\@namedef{PYG@tok@nn}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
\@namedef{PYG@tok@ne}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.80,0.25,0.22}{##1}}}
\@namedef{PYG@tok@nv}{\def\PYG@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\@namedef{PYG@tok@no}{\def\PYG@tc##1{\textcolor[rgb]{0.53,0.00,0.00}{##1}}}
\@namedef{PYG@tok@nl}{\def\PYG@tc##1{\textcolor[rgb]{0.46,0.46,0.00}{##1}}}
\@namedef{PYG@tok@ni}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.44,0.44,0.44}{##1}}}
\@namedef{PYG@tok@na}{\def\PYG@tc##1{\textcolor[rgb]{0.41,0.47,0.13}{##1}}}
\@namedef{PYG@tok@nt}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PYG@tok@nd}{\def\PYG@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}}
\@namedef{PYG@tok@s}{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PYG@tok@sd}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PYG@tok@si}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.64,0.35,0.47}{##1}}}
\@namedef{PYG@tok@se}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.67,0.36,0.12}{##1}}}
\@namedef{PYG@tok@sr}{\def\PYG@tc##1{\textcolor[rgb]{0.64,0.35,0.47}{##1}}}
\@namedef{PYG@tok@ss}{\def\PYG@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\@namedef{PYG@tok@sx}{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PYG@tok@m}{\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@gh}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}
\@namedef{PYG@tok@gu}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.50,0.00,0.50}{##1}}}
\@namedef{PYG@tok@gd}{\def\PYG@tc##1{\textcolor[rgb]{0.63,0.00,0.00}{##1}}}
\@namedef{PYG@tok@gi}{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.52,0.00}{##1}}}
\@namedef{PYG@tok@gr}{\def\PYG@tc##1{\textcolor[rgb]{0.89,0.00,0.00}{##1}}}
\@namedef{PYG@tok@ge}{\let\PYG@it=\textit}
\@namedef{PYG@tok@gs}{\let\PYG@bf=\textbf}
\@namedef{PYG@tok@ges}{\let\PYG@bf=\textbf\let\PYG@it=\textit}
\@namedef{PYG@tok@gp}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}
\@namedef{PYG@tok@go}{\def\PYG@tc##1{\textcolor[rgb]{0.44,0.44,0.44}{##1}}}
\@namedef{PYG@tok@gt}{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.27,0.87}{##1}}}
\@namedef{PYG@tok@err}{\def\PYG@bc##1{{\setlength{\fboxsep}{\string -\fboxrule}\fcolorbox[rgb]{1.00,0.00,0.00}{1,1,1}{\strut ##1}}}}
\@namedef{PYG@tok@kc}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PYG@tok@kd}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PYG@tok@kn}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PYG@tok@kr}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PYG@tok@bp}{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PYG@tok@fm}{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
\@namedef{PYG@tok@vc}{\def\PYG@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\@namedef{PYG@tok@vg}{\def\PYG@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\@namedef{PYG@tok@vi}{\def\PYG@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\@namedef{PYG@tok@vm}{\def\PYG@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\@namedef{PYG@tok@sa}{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PYG@tok@sb}{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PYG@tok@sc}{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PYG@tok@dl}{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PYG@tok@s2}{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PYG@tok@sh}{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PYG@tok@s1}{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PYG@tok@mb}{\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@mf}{\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@mh}{\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@mi}{\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@il}{\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@mo}{\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PYG@tok@ch}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.24,0.48,0.48}{##1}}}
\@namedef{PYG@tok@cm}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.24,0.48,0.48}{##1}}}
\@namedef{PYG@tok@cpf}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.24,0.48,0.48}{##1}}}
\@namedef{PYG@tok@c1}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.24,0.48,0.48}{##1}}}
\@namedef{PYG@tok@cs}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.24,0.48,0.48}{##1}}}
\def\PYGZbs{\char`\\}
\def\PYGZus{\char`\_}
\def\PYGZob{\char`\{}
\def\PYGZcb{\char`\}}
\def\PYGZca{\char`\^}
\def\PYGZam{\char`\&}
\def\PYGZlt{\char`\<}
\def\PYGZgt{\char`\>}
\def\PYGZsh{\char`\#}
\def\PYGZpc{\char`\%}
\def\PYGZdl{\char`\$}
\def\PYGZhy{\char`\-}
\def\PYGZsq{\char`\'}
\def\PYGZdq{\char`\"}
\def\PYGZti{\char`\~}
% for compatibility with earlier versions
\def\PYGZat{@}
\def\PYGZlb{[}
\def\PYGZrb{]}
\makeatother

View File

@ -1,22 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{o}{\PYGZsh{}}\PYG{n+nv}{lang}\PYG{+w}{ }\PYG{n+nv}{racket}
\PYG{c+c1}{;; a cons pair of two numbers}
\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{l+m+mi}{2}\PYG{p}{)}
\PYG{c+c1}{;; a list of 3 numbers using only the cons function}
\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{2}\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{3}\PYG{+w}{ }\PYG{n+nv}{empty}\PYG{p}{)))}\PYG{+w}{ }
\PYG{c+c1}{;; a list containing a string, a number, and a nested list of three numbers using only the cons function}
\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}a string\PYGZdq{}}
\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{0}\PYG{+w}{ }
\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{2}\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{3}\PYG{+w}{ }\PYG{n+nv}{empty}\PYG{p}{)))}\PYG{+w}{ }\PYG{n+nv}{empty}\PYG{p}{)}
\PYG{+w}{ }\PYG{p}{)}
\PYG{p}{)}
\PYG{c+c1}{;; a list containing a string, a number, and a nested list of three numbers, using only the list function}
\PYG{p}{(}\PYG{n+nb}{list}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}a string\PYGZdq{}}\PYG{+w}{ }\PYG{l+m+mi}{0}\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{list}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{l+m+mi}{2}\PYG{+w}{ }\PYG{l+m+mi}{3}\PYG{p}{))}
\PYG{c+c1}{;; a list containing a string, a number, and a nested list of three numbers, using only the append function}
\PYG{p}{(}\PYG{n+nb}{append}\PYG{+w}{ }\PYG{o}{\PYGZsq{}}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}a string\PYGZdq{}}\PYG{p}{)}\PYG{+w}{ }\PYG{o}{\PYGZsq{}}\PYG{p}{(}\PYG{l+m+mi}{0}\PYG{p}{)}\PYG{+w}{ }\PYG{o}{\PYGZsq{}}\PYG{p}{((}\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{l+m+mi}{2}\PYG{+w}{ }\PYG{l+m+mi}{3}\PYG{p}{)))}
\end{Verbatim}

View File

@ -1,22 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{err}{\PYGZsh{}}\PYG{n+nv}{lang}\PYG{+w}{ }\PYG{n+nv}{racket}
\PYG{c+c1}{;; a cons pair of two numbers}
\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{l+m+mi}{2}\PYG{p}{)}
\PYG{c+c1}{;; a list of 3 numbers using only the cons function}
\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{2}\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{3}\PYG{+w}{ }\PYG{n+nv}{empty}\PYG{p}{)))}\PYG{+w}{ }
\PYG{c+c1}{;; a list containing a string, a number, and a nested list of three numbers using only the cons function}
\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}a string\PYGZdq{}}
\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{0}\PYG{+w}{ }
\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{2}\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{3}\PYG{+w}{ }\PYG{n+nv}{empty}\PYG{p}{)))}\PYG{+w}{ }\PYG{n+nv}{empty}\PYG{p}{)}
\PYG{+w}{ }\PYG{p}{)}
\PYG{p}{)}
\PYG{c+c1}{;; a list containing a string, a number, and a nested list of three numbers, using only the list function}
\PYG{p}{(}\PYG{n+nb}{list}\PYG{+w}{ }\PYG{l+s}{\PYGZdq{}a string\PYGZdq{}}\PYG{+w}{ }\PYG{l+m+mi}{0}\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{list}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{l+m+mi}{2}\PYG{+w}{ }\PYG{l+m+mi}{3}\PYG{p}{))}
\PYG{c+c1}{;; a list containing a string, a number, and a nested list of three numbers, using only the append function}
\PYG{p}{(}\PYG{n+nb}{append}\PYG{+w}{ }\PYG{o}{\PYGZsq{}}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}a string\PYGZdq{}}\PYG{p}{)}\PYG{+w}{ }\PYG{o}{\PYGZsq{}}\PYG{p}{(}\PYG{l+m+mi}{0}\PYG{p}{)}\PYG{+w}{ }\PYG{o}{\PYGZsq{}}\PYG{p}{((}\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{l+m+mi}{2}\PYG{+w}{ }\PYG{l+m+mi}{3}\PYG{p}{)))}
\end{Verbatim}

View File

@ -1,22 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{k+kn}{\PYGZsh{}lang }\PYG{n+nn}{racket}
\PYG{c+c1}{;; a cons pair of two numbers}
\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{l+m+mi}{2}\PYG{p}{)}
\PYG{c+c1}{;; a list of 3 numbers using only the cons function}
\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{2}\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{3}\PYG{+w}{ }\PYG{n+nb}{empty}\PYG{p}{)))}\PYG{+w}{ }
\PYG{c+c1}{;; a list containing a string, a number, and a nested list of three numbers using only the cons function}
\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+s+s2}{\PYGZdq{}a string\PYGZdq{}}
\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{0}\PYG{+w}{ }
\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{2}\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{3}\PYG{+w}{ }\PYG{n+nb}{empty}\PYG{p}{)))}\PYG{+w}{ }\PYG{n+nb}{empty}\PYG{p}{)}
\PYG{+w}{ }\PYG{p}{)}
\PYG{p}{)}
\PYG{c+c1}{;; a list containing a string, a number, and a nested list of three numbers, using only the list function}
\PYG{p}{(}\PYG{n+nb}{list}\PYG{+w}{ }\PYG{l+s+s2}{\PYGZdq{}a string\PYGZdq{}}\PYG{+w}{ }\PYG{l+m+mi}{0}\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{list}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{l+m+mi}{2}\PYG{+w}{ }\PYG{l+m+mi}{3}\PYG{p}{))}
\PYG{c+c1}{;; a list containing a string, a number, and a nested list of three numbers, using only the append function}
\PYG{p}{(}\PYG{n+nb}{append}\PYG{+w}{ }\PYG{o}{\PYGZsq{}}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}a string\PYGZdq{}}\PYG{p}{)}\PYG{+w}{ }\PYG{o}{\PYGZsq{}}\PYG{p}{(}\PYG{l+m+mi}{0}\PYG{p}{)}\PYG{+w}{ }\PYG{o}{\PYGZsq{}}\PYG{p}{(}\PYG{p}{(}\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{l+m+mi}{2}\PYG{+w}{ }\PYG{l+m+mi}{3}\PYG{p}{)))}
\end{Verbatim}

View File

@ -1,24 +0,0 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{k+kn}{\PYGZsh{}lang }\PYG{n+nn}{racket}
\PYG{c+c1}{;; a cons pair of two numbers}
\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{l+m+mi}{2}\PYG{p}{)}
\PYG{c+c1}{;; a list of 3 numbers using only the cons function}
\PYG{c+c1}{;; this could be more easily done using the single quote `'` (i.e., `'(1 2 3)`) but i don't use it as it seemed against the spirit of the question}
\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{2}\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{3}\PYG{+w}{ }\PYG{n+nb}{empty}\PYG{p}{)))}\PYG{+w}{ }
\PYG{c+c1}{;; a list containing a string, a number, and a nested list of three numbers using only the cons function}
\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+s+s2}{\PYGZdq{}a string\PYGZdq{}}
\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{0}\PYG{+w}{ }
\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{2}\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{cons}\PYG{+w}{ }\PYG{l+m+mi}{3}\PYG{+w}{ }\PYG{n+nb}{empty}\PYG{p}{)))}\PYG{+w}{ }\PYG{n+nb}{empty}\PYG{p}{)}
\PYG{+w}{ }\PYG{p}{)}
\PYG{p}{)}
\PYG{c+c1}{;; a list containing a string, a number, and a nested list of three numbers, using only the list function}
\PYG{p}{(}\PYG{n+nb}{list}\PYG{+w}{ }\PYG{l+s+s2}{\PYGZdq{}a string\PYGZdq{}}\PYG{+w}{ }\PYG{l+m+mi}{0}\PYG{+w}{ }\PYG{p}{(}\PYG{n+nb}{list}\PYG{+w}{ }\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{l+m+mi}{2}\PYG{+w}{ }\PYG{l+m+mi}{3}\PYG{p}{))}
\PYG{c+c1}{;; a list containing a string, a number, and a nested list of three numbers, using only the append function}
\PYG{c+c1}{;; using `'` as the arguments of the `append` function must be themselves lists}
\PYG{p}{(}\PYG{n+nb}{append}\PYG{+w}{ }\PYG{o}{\PYGZsq{}}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}a string\PYGZdq{}}\PYG{p}{)}\PYG{+w}{ }\PYG{o}{\PYGZsq{}}\PYG{p}{(}\PYG{l+m+mi}{0}\PYG{p}{)}\PYG{+w}{ }\PYG{o}{\PYGZsq{}}\PYG{p}{(}\PYG{p}{(}\PYG{l+m+mi}{1}\PYG{+w}{ }\PYG{l+m+mi}{2}\PYG{+w}{ }\PYG{l+m+mi}{3}\PYG{p}{)))}
\end{Verbatim}

Some files were not shown because too many files have changed in this diff Show More