LaTeX/Packages/Installing Extra Packages. Add-on features for LaTeX are known as packages.
Dozens of these are pre-installed with LaTeX and can be used in your documents immediately. They should all be stored in subdirectories of texmf/tex/latex named after each package. The directory name "texmf" stands for “TEX and METAFONT”. To find out what other packages are available and what they do, you should use the CTAN search page which includes a link to Graham Williams' comprehensive package catalogue. A package is a file or collection of files containing extra LaTeX commands and programming which add new styling features or modify those already existing. Www.tug.org/texlive/Contents/live/texmf-dist/doc/latex/algorithms/algorithms. Algorithms in Latex - Dr. Andrew J. Page.
A very nice package to use to create algorithms in your latex document is called algorithm2e. It creates an algorithm block which looks very neat and tidy. Its also very easy to convert existing code into a suitable format. Its structure is very much like C/C++/C#/Java code. For example: