diff --git a/6047cem_report_template.bib b/6047cem_report_template.bib new file mode 100644 index 0000000..8c396cb --- /dev/null +++ b/6047cem_report_template.bib @@ -0,0 +1,6 @@ +@book {cornelius22, + author = {Ian Cornelius}, + year = {2022}, + title = {An Example Reference of a Book}, + publisher = {6047CEM: Cyber Security Project}, +} \ No newline at end of file diff --git a/6047cem_report_template.tex b/6047cem_report_template.tex new file mode 100644 index 0000000..54caf05 --- /dev/null +++ b/6047cem_report_template.tex @@ -0,0 +1,205 @@ +\documentclass{report} + +% Sets paper size to A4 and the margin sizes. +\usepackage[a4paper, + left=1.5in, + right=1in, + top=1in, + right=1in]{geometry} +% Changes the font of the document +\renewcommand{\familydefault}{\sfdefault} +% Allows the student to use images in their report +\usepackage{graphicx} +% Allows the student to use headers and footers in their report +\usepackage{fancyhdr} +% Allows the student to use tables in their report +\usepackage{tabularx} +% Allows colours to be used in table cells +\usepackage[table]{xcolor} +% Used for filler text in this template document, can be removed prior to submission +\usepackage{lipsum} +% Allows references to be used in the report +\usepackage{natbib} +% Increases the gap between the caption and table, and bolds the label +\usepackage{caption} +\captionsetup[table]{skip=10pt} +\captionsetup[lstlisting]{skip=10pt} +\captionsetup{labelfont=bf} +% Allows code to be listed inside the report +\usepackage{listings} +% Allows the student to use glossaries to define words +\usepackage[acronym,toc]{glossaries} + +\usepackage[toc]{appendix} + + +% IMPORTANT: Fill out your details here +%% Insert your Dissertation Project Title +\newcommand{\dissertationtitle}{Dissertation Project Title} +%% Insert your first name and leave a white space after it +\newcommand{\firstname}{A } +%% Insert your last name +\newcommand{\lastname}{Student} +%% Insert your student id +\newcommand{\studentid}{000111222} +%% Insert the name of your supervisor +\newcommand{\firstsupervisor}{First Supervisors Name} +%% Insert the submission date of the report +\newcommand{\submissiondate}{14th April 2023} +%% Insert the ethics number of your application +\newcommand{\ethicsnumber}{P-999888777} + + +% Sets up the header of the document +\lhead{\dissertationtitle} +\rhead{\firstname \lastname} +\renewcommand{\headrulewidth}{0pt} +\pagestyle{fancy} + +% Imports the glossaries from the file glossary.tex +\makeglossaries +\loadglsentries[\acronymtype]{glossary} + +\begin{document} + + \nonstopmode + + \begin{titlepage} + \begin{center} + \vspace*{2cm} + {\LARGE\textbf{\dissertationtitle}} + \vspace{2cm} + \\ \textbf{\firstname \lastname} \\ + \studentid + \vspace{0.5cm} + \\ \textbf{Supervised by} \\ + \firstsupervisor + \\ \vspace{2cm} + School of Computing, Mathematics and Data Science + \\ \vspace{2cm} + \submissiondate + \vfill + \includegraphics[width=0.4\textwidth]{images/cov_uni_logo} + \end{center} + \end{titlepage} + \clearpage + + % Declaration of Originality + \thispagestyle{empty} + \noindent \textbf{6047CEM Declaration of Originality} \\ + I declare that this project is all my own work and has not been copied in part or in whole from any other source + except where duly acknowledged. + As such, all use of previously published work (from books, journals, magazines, + internet etc) has been acknowledged by citation within the main report to an item in the References or + Bibliography lists. + I also agree that an electronic copy of this project may be stored and used for purposes of + plagiarism prevention and detection. + + \vspace{0.5cm} + + \noindent \textbf{Statement of Copyright} \\ + I acknowledge that the copyright of this project report, and any product developed as part of the project, belong + to Coventry University. + Support, including funding, is available to commercialise products and services developed by staff and students. + Any revenue that is generated is split with the inventor(s) of the product or service. + For further information, please see www.coventry.ac.uk/ipr or contact ipr@coventry.ac.uk. + + \vspace{0.5cm} + + \noindent \textbf{Statement of Ethical Engagement} \\ + I declare that a proposal for this project has been submitted to the Coventry University ethics monitoring + website (https://ethics.coventry.ac.uk) and that the application number is listed below. \\ \\ + \textbf{Note:} Projects without an ethics application number will be rejected for marking. + + \vspace{1cm} + + \begin{table}[ht] + \newlength\q + \setlength\q{\dimexpr .5\textwidth -2\tabcolsep} + \begin{tabular}{p{\q}p{\q}} + \textbf{Signed:} & \textbf{Date:} \submissiondate + \end{tabular} + \label{tab:signed_declaration} + \end{table} + + \begin{table}[ht] + \newlength\q + \setlength\q{\dimexpr .5\textwidth -2\tabcolsep} + \renewcommand{\arraystretch}{1.5} + \begin{tabular}{|p{\q}|p{\q}|} + \hline + \cellcolor{black} \textcolor{white}{\textbf{First Name}} & \firstname \\ \hline + \cellcolor{black} \textcolor{white}{\textbf{Last Name}} & \lastname \\ \hline + \cellcolor{black} \textcolor{white}{\textbf{Student ID}} & \studentid \\ \hline + \cellcolor{black} \textcolor{white}{\textbf{Ethics Application Number}} & \ethicsnumber \\ \hline + \cellcolor{black} \textcolor{white}{\textbf{First Supervisors Name}} & \firstsupervisor \\ \hline + \end{tabular} + \label{tab:ethics_details} + \end{table} + \clearpage + + % Abstract of your project + \thispagestyle{empty} + \begin{abstract} + \lipsum[2-4] + \end{abstract} + \clearpage + + % Table of Contents + \tableofcontents + \clearpage + + % List of Tables + \listoftables + \clearpage + + % List of Figures + \listoffigures + \clearpage + + % Glossary + \thispagestyle{empty} + \printglossary[type=\acronymtype,style=long] + \clearpage + + % Beginning of the Report + + %% Introduction Chapter + \input{chapters/1_Introduction.tex} + + %% Literature Review + \input{chapters/2_LiteratureReview.tex} + + %% Methodology + \input{chapters/3_Methodology.tex} + + %% Results and Analysis + \input{chapters/4_Results_Analysis.tex} + + + %% Discussion + \input{chapters/5_Discussion.tex} + + %% Project Management + \input{chapters/6_ProjectManagement.tex} + + %% Conclusion + \input{chapters/7_Conclusion.tex} + + %% References + \addcontentsline{toc}{chapter}{Bibliography} + \bibliography{6047cem_report_template} + \bibliographystyle{apalike} + + %% Appendices + \begin{appendices} + + \chapter{Code Example: SomeFile.h}\label{ch:code-example:-somefile.h} + \lstinputlisting[language=C++,label={lst:lstinputlisting}]{source_code/SomeFile.h} + + \chapter{Code Example 2: SomeFile.cpp}\label{ch:code-example-2:-somefile.cpp} + \lstinputlisting[language=C++,label={lst:lstinputlisting2}]{source_code/SomeFile.cpp} + + \end{appendices} + +\end{document} \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0296140 --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +THESIS=6047cem_report_template + +report: + pdflatex -interaction=nonstopmode -output-directory out $(THESIS).tex ; \ + makeindex $(THESIS) ; \ + bibtex out/$(THESIS) ; \ + pdflatex -interaction=nonstopmode -output-directory out $(THESIS).tex ; \ + pdflatex -interaction=nonstopmode -output-directory out $(THESIS).tex ; \ + + +clean: + rm -rf out/* \ No newline at end of file diff --git a/chapters/1_Introduction.tex b/chapters/1_Introduction.tex new file mode 100644 index 0000000..5718ec6 --- /dev/null +++ b/chapters/1_Introduction.tex @@ -0,0 +1,8 @@ +\chapter{Introduction}\label{ch:introduction} +\lipsum[2-5]~\citep{cornelius22} +\section{Research Motivation}\label{sec:research-motivation} +\lipsum[2-5] +\section{Aims and Objects}\label{sec:aims-and-objects} +\lipsum[2-5] +\section{Structure of the Report}\label{sec:structure-of-the-report} +\lipsum[2-5] \ No newline at end of file diff --git a/chapters/2_LiteratureReview.tex b/chapters/2_LiteratureReview.tex new file mode 100644 index 0000000..69ae92d --- /dev/null +++ b/chapters/2_LiteratureReview.tex @@ -0,0 +1,12 @@ +\chapter{Literature Review}\label{ch:literature-review} +\lipsum[2-5] +\section{Section 1}\label{sec:section-1} +\lipsum[2-5] +\subsection{Sub-Section 1}\label{subsec:sub-section-1} +\lipsum[2-5] +\section{Section 2}\label{sec:section-2} +\lipsum[2-5] +\subsection{Sub-Section 2}\label{subsec:sub-section-2} +\lipsum[2-5] +\section{Section 3}\label{sec:section-3} +\lipsum[2-5] \ No newline at end of file diff --git a/chapters/3_Methodology.tex b/chapters/3_Methodology.tex new file mode 100644 index 0000000..b218053 --- /dev/null +++ b/chapters/3_Methodology.tex @@ -0,0 +1,14 @@ +\chapter{Methodology}\label{ch:methodology} +\lipsum[2-5] + +\begin{lstlisting}[ + caption={An example listing of code.}, + label={lst:code_example1}, + language=Python] + def hello_world(_name): + print("Hello _name") +\end{lstlisting} + +\lipsum[2-5] + +\gls{HTML} is widely used in web-technologies. \gls{HTML} is useful because... \ No newline at end of file diff --git a/chapters/4_Results_Analysis.tex b/chapters/4_Results_Analysis.tex new file mode 100644 index 0000000..f93189d --- /dev/null +++ b/chapters/4_Results_Analysis.tex @@ -0,0 +1,19 @@ +\chapter{Results and Analysis}\label{ch:results-and-analysis} +\lipsum[2-5] + +\begin{table}[ht] + \caption{The number of people who like a given fruit.} + \newlength\q + \setlength\q{\dimexpr .5\textwidth -2\tabcolsep} + \renewcommand{\arraystretch}{1.5} + \begin{tabular}{|p{\q}|p{\q}|} + \hline + Fruit & \# of People \\ \hline + Apple & 1 \\ \hline + Blueberry & 2 \\ \hline + Cantaloupe & 3 \\ \hline + \end{tabular} + \label{tab:sample_table} +\end{table} + +\lipsum[2-5] \ No newline at end of file diff --git a/chapters/5_Discussion.tex b/chapters/5_Discussion.tex new file mode 100644 index 0000000..0f95fa2 --- /dev/null +++ b/chapters/5_Discussion.tex @@ -0,0 +1,10 @@ +\chapter{Discussion}\label{ch:discussion} +\lipsum[2-5] + +\begin{figure}[tbh] + \includegraphics[width=\columnwidth]{images/sample_graph} + \caption{A graph showing the data from Table~\ref{tab:sample_table}.} + \label{fig:sample_graph} +\end{figure} + +\lipsum[2-5] \ No newline at end of file diff --git a/chapters/6_ProjectManagement.tex b/chapters/6_ProjectManagement.tex new file mode 100644 index 0000000..2736998 --- /dev/null +++ b/chapters/6_ProjectManagement.tex @@ -0,0 +1,6 @@ +\chapter{Project Management}\label{ch:project-management} +\lipsum[2-5] +\section{Legal, Ethical and Social Constraints}\label{sec:legal-ethical-and-social-constraints} +\lipsum[2-5] +\section{Student Reflection}\label{sec:student-reflection} +\lipsum[2-5] \ No newline at end of file diff --git a/chapters/7_Conclusion.tex b/chapters/7_Conclusion.tex new file mode 100644 index 0000000..0ee391b --- /dev/null +++ b/chapters/7_Conclusion.tex @@ -0,0 +1,4 @@ +\chapter{Conclusion}\label{ch:conclusion} +\lipsum[2-5] +\section{Future Work}\label{sec:future-work} +\lipsum[2-5] \ No newline at end of file diff --git a/glossary.tex b/glossary.tex new file mode 100644 index 0000000..ce243c4 --- /dev/null +++ b/glossary.tex @@ -0,0 +1,2 @@ +\newacronym{HTML}{HTML}{Hyper-Text Markup Language} +\newacronym{CSS}{CSS}{Cascading Style Sheets} \ No newline at end of file diff --git a/images/cov_uni_logo.png b/images/cov_uni_logo.png new file mode 100644 index 0000000..4e26429 Binary files /dev/null and b/images/cov_uni_logo.png differ diff --git a/images/sample_graph.png b/images/sample_graph.png new file mode 100644 index 0000000..47c6975 Binary files /dev/null and b/images/sample_graph.png differ diff --git a/out/6047cem_report_template.pdf b/out/6047cem_report_template.pdf new file mode 100644 index 0000000..2b2eb45 Binary files /dev/null and b/out/6047cem_report_template.pdf differ diff --git a/source_code/SomeFile.cpp b/source_code/SomeFile.cpp new file mode 100644 index 0000000..6ca90d2 --- /dev/null +++ b/source_code/SomeFile.cpp @@ -0,0 +1,18 @@ +#include "header/W4.h" + +int main() { + BinaryTree bst; + bst.insert(4); + bst.insert(2); + bst.insert(6); + bst.insert(1); + bst.insert(3); + bst.insert(5); + bst.insert(7); + bst.print_tree(bst.root); +// cout << to_string(bst.find_i(bst, 5)); +// cout << to_string(bst.find_r(bst, 3)); +// bst.remove(6); +// bst.print_tree(bst.root); + return 0; +} \ No newline at end of file diff --git a/source_code/SomeFile.h b/source_code/SomeFile.h new file mode 100644 index 0000000..2e99a5f --- /dev/null +++ b/source_code/SomeFile.h @@ -0,0 +1,206 @@ +#ifndef INC_210CT___LAB_SOLUTIONS_W4_H +#define INC_210CT___LAB_SOLUTIONS_W4_H + +#include + +using namespace std; + +#define COUNT 10 + +class Node { +public: + int value; + Node *left; + Node *right; + + explicit Node(int v) : value(v), left(nullptr), right(nullptr) {}; + + ~Node() { + if(left) delete left; + if(right) delete right; + } +}; + +class BinaryTree { +public: + Node *root; + + BinaryTree() : root(nullptr) {} + + ~BinaryTree() + { + if(root) delete root; + } + + void insert(int d) { + if(root == nullptr) { + root = new Node(d); + } else { + this->_insert(d, root); + } + } + + void _insert(int data, Node *current_node){ + if(data < current_node->value) { + if(current_node->left == nullptr) { + Node *node = new Node(data); + current_node->left = node; + } else { + this->_insert(data, current_node->left); + } + } else if(data > current_node->value) { + if(current_node->right == nullptr) { + Node *node = new Node(data); + current_node->right = node; + } else { + this->_insert(data, current_node->right); + } + } + } + + void print_tree(Node *r) { + this->_print(r, 0); + } + + void _print(Node* r, int space) { + if(r == nullptr) { + return; + } + space += 10; + _print(r->right, space); + for (int i = COUNT; i < space; i++) { + cout << " "; + } + cout << r->value << endl; + _print(r->left, space); + } + +private: + // Task 1 - Find Iteratively + Node* __find_i(int target) { + Node *currentNode = root; + while(currentNode != nullptr) { + if(currentNode->value == target) { + return currentNode; + } else if(currentNode->value > target) { + currentNode = currentNode->left; + } else { + currentNode = currentNode->right; + } + } + return nullptr; + } + +public: + bool find_i(int target) { + return __find_i( target ) != nullptr; + } + + // Task 1 - Find Recursively + bool find_r(BinaryTree &tree, int target) { + if(tree.root) { + if (_find_r(target, tree.root)) { + return true; + } + return false; + } + return false; + } + + bool _find_r(int target, Node *current_node) { + if ((target > current_node->value) && (current_node->right)) { + return _find_r(target, current_node->right); + } else if ((target < current_node->value) && (current_node->left)) { + return _find_r(target, current_node->left); + } + if (target == current_node->value) { + return true; + } + return false; + } + + // Task 2 - Remove a Node + bool remove(int target) { + Node *parent = nullptr; + Node *node = root; + + while (node && node->value != target) { + parent = node; + if (target < node->value) { + node = node->left; + } else if (target > node->value) { + node = node->right; + } + } + + if( node == nullptr ) + return false; + else if( node->left == nullptr && node->right == nullptr ) { + if( parent->left == node ) { + parent->left = nullptr; + } else { + parent->right = nullptr; + } + + node->left = nullptr; + node->right = nullptr; + delete node; + return true; + } + else if( node->left && node->right == nullptr ) { + if( parent->left == node ) { + parent->left = node->left; + } else { + parent->right = node->left; + } + + node->left = nullptr; + node->right = nullptr; + delete node; + return true; + } + else if( node->left == nullptr && node->right ) { + if( parent->left == node ) { + parent->left = node->right; + } else { + parent->right = node->right; + } + + node->left = nullptr; + node->right = nullptr; + delete node; + return true; + } + + if_left_and_right(node); + + return true; + } + + void if_left_and_right(Node *node) { + Node *del_node_parent = node; + Node *del_node = node->right; + + while(del_node->left) { + del_node_parent = del_node; + del_node = del_node->left; + } + node->value = del_node->value; + + if(del_node->right) { + if(del_node_parent->value > del_node->value) { + del_node_parent->left = del_node->right; + } else { + del_node_parent->right = del_node->right; + } + } else { + if(del_node->value < del_node_parent->value) { + del_node_parent->left = nullptr; + } else { + del_node_parent->right = nullptr; + } + } + } +}; + +#endif //INC_210CT___LAB_SOLUTIONS_W4_H \ No newline at end of file