From c51d75f5a1b2cb022b1e058baf67c168471118a0 Mon Sep 17 00:00:00 2001 From: Gustavo Erlindo Dellajustina Demarchi Date: Wed, 29 Apr 2026 11:28:35 -0300 Subject: [PATCH] =?UTF-8?q?tentando=20enteder=20mais=20n=C3=A3o=20vai?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dicionario.pas | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/dicionario.pas b/dicionario.pas index 8e2d4ac..3fc55b8 100644 --- a/dicionario.pas +++ b/dicionario.pas @@ -27,7 +27,8 @@ program pzim; procedure adicionar_lista(var lista : Tlista ; chave : string); var - aux , aux2 : Tlista; + aux , aux_Ant , aux_Prox : Tlista; + temp_s : string; begin new(aux); if @@ -36,10 +37,21 @@ program pzim; begin while aux^.prox <> nil do aux := aux^.prox; - - aux^.key := chave ;// - - + temp_s := aux^.key; + + new (aux_Ant); + new (aux_Prox); + + if maior(temp_s , chave)then + begin + if aux^.ant <> nil then + aux_Ant := aux^.ant ; + if aux^.prox <> nil then + aux_Prox := aux^.prox; + + aux^.key := chave ;// + + end; end; end; @@ -71,4 +83,4 @@ begin end; begin -end. \ No newline at end of file +end.