SlideShare uma empresa Scribd logo
1 de 6
Arvore B
Principais Propositos
 1. Melhor desempenho por ter um numero menor de nos do que uma arvore
binaria, por exemplo. Menos nos, significa menos altura que resulta em
menos acessos ao disco;
 2.Ha uma economia de espaco, para garantir poucos ponteiros entre nos;
 3.Maior rapidez em buscas pela utilizacao de chaves primarias.
 4.Sua estrutura e dinamica ,ajustando automaticamente o balanceamento
da arvore, a cada inclusao/exclusao;
 5.Permite um tempo de acesso de dados menor, em uma busca aleatoria,
por causa de suas ramificacoes
Definicao
 Numero maximo de sub arvores, sera 1 a mais do que o contido na raiz,
porem , semore respeitando a ordem da arvore B
 O numero de elementos inteiros varia ente [n/2]-1 e n-1 elementos;
BUSCA em Arvore B
 A busca em uma arvore – B e similar a busca em uma arvore binaria, so
que ao inves de uma bifuracao em cada no, temos varios caminhos a seguir
de acordo com o numero de filhos do no.
1. Indica se a chave a ser procurada.
2.Pesquise desde a raiz ate encontra-la, e entao retorne o no e a posicao
desta.
3.Se a chave nao for encontrada, continue o laco ate encontrat um um
no das folhas
Insercao em Arvore B
1.Primeiro pesquise a chave, para ter a certeza de que nao existe na arvore.
2.Depois, busque a posicao onde esta inserida. Teste para ver se o no esta cheio.
3.Se o no estiver vazio, insira o valor dentro dele, senao execute uma subdivisao do no da
seguinte forma:
1.Verifique se o no-pai esta vazio, se sim execute:
1.Passe o element do meio do no para o seu pai;
2.Divida o no em dois nos iguais.
2.Se o no estiver cheio, repita as duas linhas acima recursivamente. (Caso todos os
nos-pais estiverem cheios, inclusive a raiz, deve ser criada uma nova raiz aumentando
assim a altura da arvore)
3.Somente apos satisfazer todas divisoes necessarias insira a nova chave
Exclusao em Arvore B
1. Primeiro pesquise a chave para ter a certeza de que existe na arvore.
2. Se exister , verfique se esta em folha, e faca a exclusao.
3. Se existir e nao estiver em folha, substitua esta chave pela menor chave
do filho a direita.
1.Se o numero de chaves no no, for maior do que (ordem/2-1),entao
termine a rotina.
2.Senao redistribua as chaves os vizinhos.

Mais conteúdo relacionado

Destaque

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 2024Neil Kimberley
 
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)contently
 
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 2024Albert Qian
 
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 InsightsKurio // The Social Media Age(ncy)
 
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 2024Search Engine Journal
 
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 summarySpeakerHub
 
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 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 Tessa Mero
 
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 IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
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 managementMindGenius
 
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...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 

Destaque (20)

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...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 

Arvore B: Estrutura, Busca, Inserção e Exclusão

  • 2. Principais Propositos  1. Melhor desempenho por ter um numero menor de nos do que uma arvore binaria, por exemplo. Menos nos, significa menos altura que resulta em menos acessos ao disco;  2.Ha uma economia de espaco, para garantir poucos ponteiros entre nos;  3.Maior rapidez em buscas pela utilizacao de chaves primarias.  4.Sua estrutura e dinamica ,ajustando automaticamente o balanceamento da arvore, a cada inclusao/exclusao;  5.Permite um tempo de acesso de dados menor, em uma busca aleatoria, por causa de suas ramificacoes
  • 3. Definicao  Numero maximo de sub arvores, sera 1 a mais do que o contido na raiz, porem , semore respeitando a ordem da arvore B  O numero de elementos inteiros varia ente [n/2]-1 e n-1 elementos;
  • 4. BUSCA em Arvore B  A busca em uma arvore – B e similar a busca em uma arvore binaria, so que ao inves de uma bifuracao em cada no, temos varios caminhos a seguir de acordo com o numero de filhos do no. 1. Indica se a chave a ser procurada. 2.Pesquise desde a raiz ate encontra-la, e entao retorne o no e a posicao desta. 3.Se a chave nao for encontrada, continue o laco ate encontrat um um no das folhas
  • 5. Insercao em Arvore B 1.Primeiro pesquise a chave, para ter a certeza de que nao existe na arvore. 2.Depois, busque a posicao onde esta inserida. Teste para ver se o no esta cheio. 3.Se o no estiver vazio, insira o valor dentro dele, senao execute uma subdivisao do no da seguinte forma: 1.Verifique se o no-pai esta vazio, se sim execute: 1.Passe o element do meio do no para o seu pai; 2.Divida o no em dois nos iguais. 2.Se o no estiver cheio, repita as duas linhas acima recursivamente. (Caso todos os nos-pais estiverem cheios, inclusive a raiz, deve ser criada uma nova raiz aumentando assim a altura da arvore) 3.Somente apos satisfazer todas divisoes necessarias insira a nova chave
  • 6. Exclusao em Arvore B 1. Primeiro pesquise a chave para ter a certeza de que existe na arvore. 2. Se exister , verfique se esta em folha, e faca a exclusao. 3. Se existir e nao estiver em folha, substitua esta chave pela menor chave do filho a direita. 1.Se o numero de chaves no no, for maior do que (ordem/2-1),entao termine a rotina. 2.Senao redistribua as chaves os vizinhos.