SlideShare uma empresa Scribd logo
1 de 12
Estrutura de
Dados
Listas Duplamente Encadeadas
Lista Duplamente Encadeada
É um tipo de lista encadeada que pode ser vazia ou que pode ter
um ou mais nós, sendo que cada nó possui dois ponteiros: um que
aponta para o nó anterior e outro que aponta para o próximo nó.
O importante é que, neste tipo de lista, o ponteiro externo pode apontar
para qualquer nó da lista, pois é possível caminhar para a direita ou para
a esquerda com igual facilidade.
No
Ponteiro Anterior.
Ponteiro Próximo.
Lista Duplamente Encadeada
No1 No 2 No 3 No 4
Em uma lista duplamente
encadeada é possível
percorrer a lista em ambas
as direções.
Também apresenta uma
maior segurança do que
uma lista simplesmente
encadeada uma vez que,
existe sempre dois ponteiros
apontando para cada registro.
                        Implementando:
Struct Tpreg{
       char nome[25];
       void *ant,*depois;
};
typedef struct Tpreg registro;
registro *Auxiliar,*Anterior, *Atual,*Proximo;
Auxiliar = Inicio = Fim = Anterior = NULL;
registro* busca(){
      char nomeE[];
      int achou = 0;
      scanf("%s", nomeE);
      Anterior = Atual->ant;
      while(Atual != NULL && achou == 0){
            if(strcmp( nomeE,Atual->nome)==0){
                  achou = 1;
            }else{
    if(strcmp( nomeE,Atual- >nome)>0){                 
                        Atual = Anterior;   
                        Anterior = Atual->ant;   
                 }else{   
                        Atual=Atual->prox;   
                        Anterior = Atual->ant;   
                 }   
      }   
}   
return Atual; }
                 
Custo da busca total:
O(n) pois a busca é do
tipo sequencial.
                                 Busca
Nome
“C3”
Nome
“C3”
Nome
“C3”
No (n-3)
Nome
“C1”
No (n-2)
Nome
“C2”
No (n-1)
Nome
“C3”
No n
Nome
“...”
A função busca ira varrer a lista, iniciando
do ultimo registro adicionado, ate ser
encontrado o nome digitado pelo usuário
em um dos elementos da lista.
Caso o nome não seja encontrado na lista
a função ira retornar “NULL”. Observe que
a lista esta ordenada alfabeticamente.
Nome digitado
pelo usuário.
Ponteiro Atual
                                 Inserção
No (n-3)
Nome
“C1”
No (n-1)
Nome
“C3”
No n
Nome
“...”
No (n-2)
Nome
“C2”
Novo elemento.
Ponteiro Anterior Ponteiro Atual
void inserir(){
char nomeE[25];
Auxiliar = (registro *) malloc (sizeof(registro));
scanf("%s", Auxiliar→nomeE);
Auxiliar→prox = NULL;
Auxiliar→ant = NULL;
if(Atual == NULL){
Atual = Auxiliar;
}else{
Anterior = Atual->ant;
while(Atual != NULL){
if(strcmp( nomeE,Atual->nome)>0 && strcmp( nomeE,Anterior->nome)<0){
Anterior->prox=Auxiliar;
Auxiliar->ant = Anterior;
Atual->ant = Auxiliar;
Auxiliar->prox = Atual;
}else if( strcmp( nomeE,Anterior->nome)>0){
Atual = Anterior;
Anterior = Atual->ant;
}else{
Atual = Atual->prox;
Anterior = Atual->ant;
}
}
}
...
Remoção
No (n-3)
Nome
“C”
No (n-2)
Nome
“C#”
No (n-1)
Nome
“C++”
Deletado
Nome
“Java”
No n
Nome
“...”
void remover(){
Atual = Busca();
if(Atual ->ant ==NULL)
Proximo = Atual->prox;
free(Atual);
Proximo->ant = NULL;
}else{
if(Atual->prox==NULL){
Anterior = Atual->ant;
free(Atual);
Anterior->prox =NULL;
}
else{
Anterior = Atual->ant;
Anterior ->prox = Atual->prox;
Proximo = Atual->prox;
Proximo->ant = Anterior;
free(Atual);
}
Lista Sequencial Duplamente encadeada
Uma Lista Sequencial Duplamente encadeada implementada em vetores, em
que uma coluna indica qual o dado anterior e outra coluna que indica qual é o
proximo e a posição é o índice.
                       Aplicações: 
A lista duplamente encadeada é bem 
utilizada em situações em que a navegação é 
feita nos dois sentidos.
Situações:
●Um reprodutor de músicas.
●Estoque de um mercado.
●Gerenciamento de contas de um banco.
●Redes sociais.
Participantes
•DANIELLE TAYNARA DOS SANTOS SILVA
•FELIPE ANTONIO SCHERER DIAS
•JOAO MARCOS DE OLIVEIRA RODRIGUES
•JOAO MARCELO DOS SANTOS NASCIMENTO
•JOAO VITOR RIBEIRO VIANA 
• JOSE VALMIR DE ARAUJO FILHO
•JUSTINO BISPO NETO
•MATHEUS SANTOS ALMEIDA
•THOMÉ PEREIRA ALVES NETO 
•WELERSON AUGUSTO LINO DE JESUS MELO 
Fonte:
●
Szwarcfiter, J. L.; Markenzon, L. ESTRUTURA DE DADOS E SEUS ALGORITMOS. 3ª ed.
Rio de Janeiro: LTC, 2010. 318 p.
●
Celes, Waldemar et al. INTRODUÇÃO A ESTRUTURA DE DADOS: COM TÉCNICAS DE
PROGRAMAÇÃO EM C. 2ª ed. Rio de Janeiro: Elsevier, 2004. 410 p.

Mais conteúdo relacionado

Mais procurados

Fundamentos de Padrões de Projeto de Software
Fundamentos de Padrões de Projeto de SoftwareFundamentos de Padrões de Projeto de Software
Fundamentos de Padrões de Projeto de SoftwareÁlvaro Farias Pinheiro
 
Estruturas de Repetição - FOR, WHILE e DO WHILE
Estruturas de Repetição - FOR, WHILE e DO WHILEEstruturas de Repetição - FOR, WHILE e DO WHILE
Estruturas de Repetição - FOR, WHILE e DO WHILENeto Côrtes
 
Árvores: Conceitos e binárias
Árvores:  Conceitos e bináriasÁrvores:  Conceitos e binárias
Árvores: Conceitos e bináriasSérgio Souza Costa
 
Comandos DDL para o MySQL
Comandos DDL para o MySQLComandos DDL para o MySQL
Comandos DDL para o MySQLArley Rodrigues
 
JavaScript - Introdução com Orientação a Objetos
JavaScript - Introdução com Orientação a ObjetosJavaScript - Introdução com Orientação a Objetos
JavaScript - Introdução com Orientação a ObjetosEduardo Mendes
 
Types of Tree in Data Structure in C++
Types of Tree in Data Structure in C++Types of Tree in Data Structure in C++
Types of Tree in Data Structure in C++Himanshu Choudhary
 
Linguagem C - Vetores, Matrizes e Funções
Linguagem C - Vetores, Matrizes e FunçõesLinguagem C - Vetores, Matrizes e Funções
Linguagem C - Vetores, Matrizes e FunçõesElaine Cecília Gatto
 
Estrutura de Dados e Algoritmos com Java #02-12: Vetores e Arrays
Estrutura de Dados e Algoritmos com Java #02-12: Vetores e ArraysEstrutura de Dados e Algoritmos com Java #02-12: Vetores e Arrays
Estrutura de Dados e Algoritmos com Java #02-12: Vetores e ArraysLoiane Groner
 

Mais procurados (20)

Estrutura de dados - Filas
Estrutura de dados - FilasEstrutura de dados - Filas
Estrutura de dados - Filas
 
Estrutura de Dados - Listas Encadeadas
Estrutura de Dados - Listas EncadeadasEstrutura de Dados - Listas Encadeadas
Estrutura de Dados - Listas Encadeadas
 
Fundamentos de Padrões de Projeto de Software
Fundamentos de Padrões de Projeto de SoftwareFundamentos de Padrões de Projeto de Software
Fundamentos de Padrões de Projeto de Software
 
Linguagem C - Vetores
Linguagem C - VetoresLinguagem C - Vetores
Linguagem C - Vetores
 
Atalhos de teclado gerais
Atalhos de teclado geraisAtalhos de teclado gerais
Atalhos de teclado gerais
 
Estruturas de Repetição - FOR, WHILE e DO WHILE
Estruturas de Repetição - FOR, WHILE e DO WHILEEstruturas de Repetição - FOR, WHILE e DO WHILE
Estruturas de Repetição - FOR, WHILE e DO WHILE
 
Heap
HeapHeap
Heap
 
AVL Tree
AVL TreeAVL Tree
AVL Tree
 
Árvores: Conceitos e binárias
Árvores:  Conceitos e bináriasÁrvores:  Conceitos e binárias
Árvores: Conceitos e binárias
 
Metodos de ordenamiento
Metodos de ordenamientoMetodos de ordenamiento
Metodos de ordenamiento
 
Comandos DDL para o MySQL
Comandos DDL para o MySQLComandos DDL para o MySQL
Comandos DDL para o MySQL
 
Splay Tree
Splay TreeSplay Tree
Splay Tree
 
Linked list
Linked listLinked list
Linked list
 
JavaScript - Introdução com Orientação a Objetos
JavaScript - Introdução com Orientação a ObjetosJavaScript - Introdução com Orientação a Objetos
JavaScript - Introdução com Orientação a Objetos
 
Disjoint sets
Disjoint setsDisjoint sets
Disjoint sets
 
Types of Tree in Data Structure in C++
Types of Tree in Data Structure in C++Types of Tree in Data Structure in C++
Types of Tree in Data Structure in C++
 
Linguagem C - Vetores, Matrizes e Funções
Linguagem C - Vetores, Matrizes e FunçõesLinguagem C - Vetores, Matrizes e Funções
Linguagem C - Vetores, Matrizes e Funções
 
Aula 08 - árvores
Aula 08 - árvoresAula 08 - árvores
Aula 08 - árvores
 
Estrutura de Dados e Algoritmos com Java #02-12: Vetores e Arrays
Estrutura de Dados e Algoritmos com Java #02-12: Vetores e ArraysEstrutura de Dados e Algoritmos com Java #02-12: Vetores e Arrays
Estrutura de Dados e Algoritmos com Java #02-12: Vetores e Arrays
 
CSS
CSSCSS
CSS
 

Destaque

METAS DEL GOBIERNO EN LA LUCHA CONTRA LA DESNUTRICIÓN INFANTIL - Julio 2016
METAS DEL GOBIERNO EN LA LUCHA CONTRA LA DESNUTRICIÓN INFANTIL - Julio 2016METAS DEL GOBIERNO EN LA LUCHA CONTRA LA DESNUTRICIÓN INFANTIL - Julio 2016
METAS DEL GOBIERNO EN LA LUCHA CONTRA LA DESNUTRICIÓN INFANTIL - Julio 2016SUN Civil Society Network
 
ロボカップ世界大会報告@IPAセキュリティキャンプ全国大会2016チューター成果報告
ロボカップ世界大会報告@IPAセキュリティキャンプ全国大会2016チューター成果報告ロボカップ世界大会報告@IPAセキュリティキャンプ全国大会2016チューター成果報告
ロボカップ世界大会報告@IPAセキュリティキャンプ全国大会2016チューター成果報告Kensei Demura
 
American locker overview_2017
American locker overview_2017American locker overview_2017
American locker overview_2017Terry Woolford
 
R. VILLANO - Pubblicazioni religiose
R. VILLANO - Pubblicazioni religioseR. VILLANO - Pubblicazioni religiose
R. VILLANO - Pubblicazioni religioseRaimondo Villano
 
MOBILE APP BENCHMARK: TOP 10 MOBILE SHOPPING APPS IN THE US
MOBILE APP BENCHMARK: TOP 10 MOBILE SHOPPING APPS IN THE USMOBILE APP BENCHMARK: TOP 10 MOBILE SHOPPING APPS IN THE US
MOBILE APP BENCHMARK: TOP 10 MOBILE SHOPPING APPS IN THE USAT Internet
 
言語文化教育研究学会2017年2月
言語文化教育研究学会2017年2月言語文化教育研究学会2017年2月
言語文化教育研究学会2017年2月Kayoko ARITA
 
Tracxn Research - Chatbots Landscape, February 2017
Tracxn Research - Chatbots Landscape, February 2017Tracxn Research - Chatbots Landscape, February 2017
Tracxn Research - Chatbots Landscape, February 2017Tracxn
 
Tracxn Research - Solar Energy Landscape, February 2017
Tracxn Research - Solar Energy Landscape, February 2017Tracxn Research - Solar Energy Landscape, February 2017
Tracxn Research - Solar Energy Landscape, February 2017Tracxn
 
Re- Imagine the way How HR is reshaped for Start up community
Re- Imagine the way How HR is reshaped for Start up community Re- Imagine the way How HR is reshaped for Start up community
Re- Imagine the way How HR is reshaped for Start up community Maj. Shailesh Kumar
 

Destaque (14)

النشرة الإلكترونية الشهرية - العدد 22 - أيار/ 2016 - جمعية الإرشاد والإصلاح
النشرة الإلكترونية الشهرية - العدد 22 - أيار/ 2016 - جمعية الإرشاد والإصلاحالنشرة الإلكترونية الشهرية - العدد 22 - أيار/ 2016 - جمعية الإرشاد والإصلاح
النشرة الإلكترونية الشهرية - العدد 22 - أيار/ 2016 - جمعية الإرشاد والإصلاح
 
Proyecto i
Proyecto iProyecto i
Proyecto i
 
Jkumar retail india profile
Jkumar retail india profileJkumar retail india profile
Jkumar retail india profile
 
Presentación general fundación éxito
Presentación general fundación éxitoPresentación general fundación éxito
Presentación general fundación éxito
 
METAS DEL GOBIERNO EN LA LUCHA CONTRA LA DESNUTRICIÓN INFANTIL - Julio 2016
METAS DEL GOBIERNO EN LA LUCHA CONTRA LA DESNUTRICIÓN INFANTIL - Julio 2016METAS DEL GOBIERNO EN LA LUCHA CONTRA LA DESNUTRICIÓN INFANTIL - Julio 2016
METAS DEL GOBIERNO EN LA LUCHA CONTRA LA DESNUTRICIÓN INFANTIL - Julio 2016
 
ロボカップ世界大会報告@IPAセキュリティキャンプ全国大会2016チューター成果報告
ロボカップ世界大会報告@IPAセキュリティキャンプ全国大会2016チューター成果報告ロボカップ世界大会報告@IPAセキュリティキャンプ全国大会2016チューター成果報告
ロボカップ世界大会報告@IPAセキュリティキャンプ全国大会2016チューター成果報告
 
American locker overview_2017
American locker overview_2017American locker overview_2017
American locker overview_2017
 
R. VILLANO - Pubblicazioni religiose
R. VILLANO - Pubblicazioni religioseR. VILLANO - Pubblicazioni religiose
R. VILLANO - Pubblicazioni religiose
 
MOBILE APP BENCHMARK: TOP 10 MOBILE SHOPPING APPS IN THE US
MOBILE APP BENCHMARK: TOP 10 MOBILE SHOPPING APPS IN THE USMOBILE APP BENCHMARK: TOP 10 MOBILE SHOPPING APPS IN THE US
MOBILE APP BENCHMARK: TOP 10 MOBILE SHOPPING APPS IN THE US
 
言語文化教育研究学会2017年2月
言語文化教育研究学会2017年2月言語文化教育研究学会2017年2月
言語文化教育研究学会2017年2月
 
ECSC-SUN newsletter January 2017
ECSC-SUN newsletter January 2017ECSC-SUN newsletter January 2017
ECSC-SUN newsletter January 2017
 
Tracxn Research - Chatbots Landscape, February 2017
Tracxn Research - Chatbots Landscape, February 2017Tracxn Research - Chatbots Landscape, February 2017
Tracxn Research - Chatbots Landscape, February 2017
 
Tracxn Research - Solar Energy Landscape, February 2017
Tracxn Research - Solar Energy Landscape, February 2017Tracxn Research - Solar Energy Landscape, February 2017
Tracxn Research - Solar Energy Landscape, February 2017
 
Re- Imagine the way How HR is reshaped for Start up community
Re- Imagine the way How HR is reshaped for Start up community Re- Imagine the way How HR is reshaped for Start up community
Re- Imagine the way How HR is reshaped for Start up community
 

Listas Duplamente Encadeadas: Estrutura, Implementação e Aplicações

Notas do Editor

  1. 24/02/2017
  2. 24/02/2017
  3. 24/02/2017
  4. 24/02/2017
  5. 24/02/2017
  6. 24/02/2017
  7. 24/02/2017
  8. 24/02/2017
  9. 24/02/2017