Auto-detecting the presence or absence of floats might get messed up if the user is in the habit of deleting the aux files compulsively. (You'd be surprised how common this obsession is...) I would therefore like to suggest you take a different approach: provide three documentclass-level options: nofigures, notables, and noalgorithms, to be specified by the user him/herself. If these options are specified, no list of figures, no list of tables, and no list of algorithms, respectively, is generated.
The following code should illustrate this suggestion in more detail. It sets up both a document class file called myclass.cls (you're obviously free to choose a more imaginative name!), which sets up the new options and then invokes the report class, as well as a sample user .tex file that employs the myclass document class.
Addendum: On @Werner's suggestion, I've added code for three user-level macros: \nofigures, \notables, and \noalgorithms. They may be inserted by the user in the preamble, as an alternative to providing the corresponding options at the \documentclass stage
First, the code for the class file (to be saved as myclass.cls):
\NeedsTeXFormat{LaTeX2e}[2015/01/01]
\ProvidesClass{myclass}[2018/02/21]
% define three new documentclass-level options
\newif\ifnofigures\nofiguresfalse
\newif\ifnotables\notablesfalse
\newif\ifnoalgorithms\noalgorithmsfalse
\DeclareOption{nofigures}{\nofigurestrue}
\DeclareOption{notables}{\notablestrue}
\DeclareOption{noalgorithms}{\noalgorithmstrue}
\ProcessOptions\relax
\LoadClass[]{report}
% provide three user commands: \nofigures, \notables, \noalgorithms
% (to be used as an alternative to setting documentclass-level options)
\newcommand\nofigures{\let\ifnofigures\iftrue}
\newcommand\notables{\let\ifnotables\iftrue}
\newcommand\noalgorithms{\let\ifnoalgorithms\iftrue}
\usepackage{algorithmicx,algorithm,algpseudocode}
% load any and all other default packages
\AtBeginDocument{%
\pagenumbering{roman}
\maketitle % or, likely, something far more elaborate
\ifnofigures\else\listoffigures\fi
\ifnotables\else\listoftables\fi
\ifnoalgorithms\else\listofalgorithms\fi
\clearpage
\pagenumbering{arabic}
}
Second, a sample user document. Note that if all three of the new documentclass options -- nofigures, notables, and noalgorithms -- are specified, no lists of figures, tables, and algorithms are created.
\documentclass[nofigures,notables,noalgorithms]{myclass}
\title{Thoughts}
\author{A. Person}
\date{\today}
\begin{document}
xxx
\end{document}
\listoffigures. – Skillmon Feb 21 '18 at 19:42xelatex -syntex=-1 thesis.texand not running another program. – Ali Shakiba Feb 21 '18 at 19:43