forked from tomieiro/std-moon
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharvore_binaria.lua
More file actions
36 lines (28 loc) · 756 Bytes
/
Copy patharvore_binaria.lua
File metadata and controls
36 lines (28 loc) · 756 Bytes
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
local No = {NoEsq = 0, NoDir = 0, valor = 0}
function No:new(atributos)
atributos = atributos or {};
setmetatable(atributos, self);
self.__index = self;
return atributos;
end
function No:insert_filho(no_filho)
end
Arvore = {itens = {}, profundidade = 0, raiz = 0;
--Metodo construtor que instancia o objeto Arvore Binaria.
--args: (Table) Atributos desejados para a arvore.
--return: (Object) Lista instanciada.
function Arvore:new(atributos)
atributos = atributos or {};
setmetatable(atributos, self);
self.__index = self;
return atributos;
end
function Arvore:insert(elem)
if(self.raiz == 0) then
self.raiz = cria_no(elem);
else
local aux = busca_no();
aux.insert_filho();
end
end
return Arvore;