SlideShare uma empresa Scribd logo
1 de 11
LISTAS CIRCULARES
Kaique, Felipe, Luan, Weiler, Tulasi, Ian,
Gabriel Fonseca, Gabriel Marianni, Tarcísio, João Vitor, João
Pedro.
CONCEITO
“Numa lista circular, o último elemento tem como
próximo o primeiro elemento da lista, formando um
ciclo. A rigor, neste caso, não faz sentido falarmos em
primeiro ou último”.
(Celes, Cerqueira e Rangel, 2016, 2 ed.).
Fig. 1 – Arranjo de memoria de uma lista circular
(“Introdução a Estrutura de Dados”- Elsevier, 2016, 2 ed.)
IMPLEMENTAÇÃO
Implementação dinâmica:
struct lista{
int info;
struct lista* proximo;
};
typedef struct lista Listacircular;
Listacircular* inicio, fim;
Implementação estática:
#define TAM...
typedef char elem;
typedef struct lista Lista;
typedef struct bloco {
elem item;
int prox; }
no;
struct lista {
int ini, primeiro_vazio;
no itens[TAM];
int tam;
} ;
EXEMPLO DE OPERAÇÃO: INSERINDO EM UMA
LISTA VAZIA:
 int ins_lista_circ_vazia(Lista lista, char dado){
 Elemento novo_elemento;
 if (( novo_elemento = (Elemento ) malloc (sizeof (Elemento)))
 == NULL)
 return -1;
 if ((novo_elemento > dado = (char ) malloc (50 sizeof (char)))
 == NULL)
 return -1;
 strcpy (novo_elemento > dado, dado);

 novo_elemento > seguinte = novo_elemento;
 liste > início = novo_elemento;
 liste > fim = novo_elemento;
 liste > tamanho++;
 return 0;
 }
APLICAÇÃO PRATICA
 Uma boa aplicação da lista circular é a opção repetir em
players de música que reproduz todas as músicas
repetidamente.
Fig. 2 – Spotify AB
OPERAÇÕES
 Numa lista circular é possível efetuar 4 principais
operações:
- Inserção;
- Remoção;
- Busca;
- Alteração.
BUSCA
 A função busca é usada para localizar um dado
desejado na lista;
 A busca tem um custo de tempo no melhor caso
constante O(k) e um pior caso da ordem O(n).
INSERÇÃO
 Função que adiciona um elemento na lista;
 Possui custo constante O(k) caso a lista seja
desordenada e não tenha a necessidade de
verificar dados repetidos;
 Possui custo linear O(n) caso a lista seja ordenada,
pois é necessário identificar a posição da inserção.
REMOÇÃO
 A remoção consiste na localização de um elemento
e exclusão da lista;
 O custo de tempo da remoção no melhor caso é de
ordem constante O(k) e no pior caso é de ordem
linear O(n).
ALTERAÇÃO
 Utilizado para modificar a informação contida no
elemento escolhido;
 Seu custo segue o mesmo principio da remoção.
FONTES
 Celes, W.; Cerqueira, R.; Rangel, J.;
Introdução a Estrutura de Dados, 2 ed. Rio de Janeiro: Elsevier,
2016.
 Cox, Kenia.
 Slides: “Listas Lineares” Aracaju, Sergipe, 2017.
 Tenenbaum, Aaron; Langsam, Yebdyah; Augustiin, Moshe J.
Estruturas de Dados Usando C. Prertice hall: 1995. 884p.
 Listas Circulares (Ring Buffer). Disponível em: <
http://br.ccm.net/faq/10226-listas-circulares-ring-buffer >.

Mais conteúdo relacionado

Destaque

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Destaque (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Listas circulares ed

  • 1. LISTAS CIRCULARES Kaique, Felipe, Luan, Weiler, Tulasi, Ian, Gabriel Fonseca, Gabriel Marianni, Tarcísio, João Vitor, João Pedro.
  • 2. CONCEITO “Numa lista circular, o último elemento tem como próximo o primeiro elemento da lista, formando um ciclo. A rigor, neste caso, não faz sentido falarmos em primeiro ou último”. (Celes, Cerqueira e Rangel, 2016, 2 ed.). Fig. 1 – Arranjo de memoria de uma lista circular (“Introdução a Estrutura de Dados”- Elsevier, 2016, 2 ed.)
  • 3. IMPLEMENTAÇÃO Implementação dinâmica: struct lista{ int info; struct lista* proximo; }; typedef struct lista Listacircular; Listacircular* inicio, fim; Implementação estática: #define TAM... typedef char elem; typedef struct lista Lista; typedef struct bloco { elem item; int prox; } no; struct lista { int ini, primeiro_vazio; no itens[TAM]; int tam; } ;
  • 4. EXEMPLO DE OPERAÇÃO: INSERINDO EM UMA LISTA VAZIA:  int ins_lista_circ_vazia(Lista lista, char dado){  Elemento novo_elemento;  if (( novo_elemento = (Elemento ) malloc (sizeof (Elemento)))  == NULL)  return -1;  if ((novo_elemento > dado = (char ) malloc (50 sizeof (char)))  == NULL)  return -1;  strcpy (novo_elemento > dado, dado);   novo_elemento > seguinte = novo_elemento;  liste > início = novo_elemento;  liste > fim = novo_elemento;  liste > tamanho++;  return 0;  }
  • 5. APLICAÇÃO PRATICA  Uma boa aplicação da lista circular é a opção repetir em players de música que reproduz todas as músicas repetidamente. Fig. 2 – Spotify AB
  • 6. OPERAÇÕES  Numa lista circular é possível efetuar 4 principais operações: - Inserção; - Remoção; - Busca; - Alteração.
  • 7. BUSCA  A função busca é usada para localizar um dado desejado na lista;  A busca tem um custo de tempo no melhor caso constante O(k) e um pior caso da ordem O(n).
  • 8. INSERÇÃO  Função que adiciona um elemento na lista;  Possui custo constante O(k) caso a lista seja desordenada e não tenha a necessidade de verificar dados repetidos;  Possui custo linear O(n) caso a lista seja ordenada, pois é necessário identificar a posição da inserção.
  • 9. REMOÇÃO  A remoção consiste na localização de um elemento e exclusão da lista;  O custo de tempo da remoção no melhor caso é de ordem constante O(k) e no pior caso é de ordem linear O(n).
  • 10. ALTERAÇÃO  Utilizado para modificar a informação contida no elemento escolhido;  Seu custo segue o mesmo principio da remoção.
  • 11. FONTES  Celes, W.; Cerqueira, R.; Rangel, J.; Introdução a Estrutura de Dados, 2 ed. Rio de Janeiro: Elsevier, 2016.  Cox, Kenia.  Slides: “Listas Lineares” Aracaju, Sergipe, 2017.  Tenenbaum, Aaron; Langsam, Yebdyah; Augustiin, Moshe J. Estruturas de Dados Usando C. Prertice hall: 1995. 884p.  Listas Circulares (Ring Buffer). Disponível em: < http://br.ccm.net/faq/10226-listas-circulares-ring-buffer >.