-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbusca_profundidade_lugger.tex
52 lines (43 loc) · 1.25 KB
/
busca_profundidade_lugger.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
% Copyright 2025 by Marcos Laureano (marcos.laureano@ifpr.edu.br)
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,mathtools,lmodern,amssymb}
\usepackage[portuguese,linesnumbered,inoutnumbered]{algorithm2e}
\SetKw{Kwpasso}{passo}
\SetKwProg{Fn}{Função}{}{}
\renewcommand{\thealgocf}{} %desativa o contador de algoritmos
\begin{document}
%
%
\begin{algorithm}[H]
\Inicio{
abertos = [Início] \tcp*{Inicialização}
fechados = [];\\
\BlankLine
\tcp{restam estados}
\Enqto{abertos $\neq$ []}{
remova o estado mais à esquerda em abertos, chame-o de X
\BlankLine
\tcp{objetivo encontrado}
\Se{X for um objetivo}{
\KwRetorna{SUCESSO}}
\Senao{
gere filhos de X;\\
coloque X em fechados;\\
\BlankLine
\tcp{checagem de laços}
descarte filhos de X se já estiverem em abertos ou fechados;
\BlankLine
\tcp{põe na pilha}
coloque os filhos que restam no final à esquerda de abertos;
}
}
\KwRetorna{FALHA} \tcp*{não restam estados}
}
\caption{Busca em Profundidade}
\end{algorithm}
\end{document}