SlideShare a Scribd company logo
1 of 30
Download to read offline
20210906 김연재
B tree
Kingw
a
ngzh
a
ng dif
f
iculty
하 놀러가고싶다
놀러가고싶다고..
Tree
Binary tree
Binary search tree
Balanced tree
Index
B-tree
Tree 란?
1. 자기 자신을 반복하는 자료구조
2. 순환구조를 갖지않는 그래프
3. 단방향 자료구조
4. 자식 노드는 하나의 부모노드를 가짐
Binary tree 란?
1. 자기 자신을 반복하는 자료구조
2. 순환구조를 갖지않는 그래프
3. 단방향 자료구조
4. 하나의 부모노드, 하나의 자식 노드를 가짐
5. 모든 노드의 차수가 2 이하인 트리
차수 2
Binary search tree 란?
1. 자기 자신을 반복하는 자료구조
2. 순환구조를 갖지않는 그래프
3. 단방향 자료구조
4. 하나의 부모노드, 하나의 자식 노드를 가짐
5. 모든 노드의 차수가 2 이하인 트리
6. 정렬된 트리
7. 노드의 왼쪽 서브트리에는 해당 노드보다 작은값
8. 노드의 오른쪽 서브트리에는 해당 노드보다 큰 값
9. 탐색시간이 log값을 가짐
B-tree => self balanced tree
Server
Disk
Memory
_id 이름 성별 주민등록번호
1 Dana


여 940821-2
2 Cona


여 920907-2
3 Kelly


여 900102-2
4 왕배 남 812345-1
5 Duckduck


남 860907-1
6 Yep


남 912345-1
7 Oak


여 9912345-2
8 Won


남 9412345-1
… … … …
100 김수한무 여 951202-2
512 bytes
COLLSCAN => 25 BLOCKS
대용량 데이터에 부적합
COLLSCAN || Full table scan
_id Point
er
1 85~86
2 87~88
3 89~90
4 91~92
5 93~94
512 bytes
_id 이름 성별 주민등록번
호
… … … …
4 왕배 남 812345-1
5 Duckduck


남 860907-1
3 Kelly


여 900102-2
6 Yep


남 912345-1
2 Cona


여 920907-2
1 Dana


여 940821-2
8 Won


남 9412345-1
100 김수한무 여 951202-2
7 Oak


여 9912345-2
16bytes
최대 5 Blocks
Multi level index
1,000 rows, 250 blocks
40 blocks
4 blocks
Multi level index
B tree
트리 내의 자료들은 모두 정렬된 상태
노드 내의 키들은 모두 정렬된 상태이다.
K1 < k2 < k3
B tree
하나의 노드에 최대 (M/2) - 1 개 부터 M-1 개의 키 존재
Ex : 3차 B-tree의 최소 key수는 1개, 최대 key수는 2개
B tree
모든 리프노드가 동일한 레벨에 있음
B tree
Key 생성 프로세스는 상향식으로 이루어짐
B tree
Keys : [10,20,30,40], 4차 B-tree
10 20 30 40
B tree
Keys : [10,20,30,40], 4차 B-tree
30 40
20
10
B tree
Keys : [10,20,30,40,50,60,70,80,90,100]
4차 B-tree
B tree
Keys : [10,20,30,40], 4차 B-tree
B tree 삽입
1. 리프노드이면서, 삽입할 노드의 key 갯수가 최대일 때
2. 리프노드이면서, 삽입할 노드의 key 갯수가 최대 미만일 때
B tree 삭제
1. 삭제할 데이터가 리프노드에 있으면서, 최소key 갯수를 보
장할 때
2. 리프노드에 있고, 최소 key를 보장하지 않을 때
3. 리프노드에 있고, 인접한 형제 노드들이 최소 key일 때
4. 리프노드가 아니고, 최소 Key를 보장할 때
5. 리프노드가 아니고, 최소 key를 보장하지 않을 때
링크
끝

More Related Content

Recently uploaded

MOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution DetectionMOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution DetectionKim Daeun
 
캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차캐드앤그래픽스
 
A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)Tae Young Lee
 
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...Kim Daeun
 
Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)Wonjun Hwang
 
Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)Wonjun Hwang
 

Recently uploaded (6)

MOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution DetectionMOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution Detection
 
캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차
 
A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)
 
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
 
Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)
 
Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)
 

Featured

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
 

Featured (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
 

B tree & index

  • 3. Tree 란? 1. 자기 자신을 반복하는 자료구조 2. 순환구조를 갖지않는 그래프 3. 단방향 자료구조 4. 자식 노드는 하나의 부모노드를 가짐
  • 4.
  • 5. Binary tree 란? 1. 자기 자신을 반복하는 자료구조 2. 순환구조를 갖지않는 그래프 3. 단방향 자료구조 4. 하나의 부모노드, 하나의 자식 노드를 가짐 5. 모든 노드의 차수가 2 이하인 트리
  • 7. Binary search tree 란? 1. 자기 자신을 반복하는 자료구조 2. 순환구조를 갖지않는 그래프 3. 단방향 자료구조 4. 하나의 부모노드, 하나의 자식 노드를 가짐 5. 모든 노드의 차수가 2 이하인 트리 6. 정렬된 트리 7. 노드의 왼쪽 서브트리에는 해당 노드보다 작은값 8. 노드의 오른쪽 서브트리에는 해당 노드보다 큰 값 9. 탐색시간이 log값을 가짐
  • 8.
  • 9.
  • 10.
  • 11. B-tree => self balanced tree
  • 12.
  • 14. _id 이름 성별 주민등록번호 1 Dana 여 940821-2 2 Cona 여 920907-2 3 Kelly 여 900102-2 4 왕배 남 812345-1 5 Duckduck 남 860907-1 6 Yep 남 912345-1 7 Oak 여 9912345-2 8 Won 남 9412345-1 … … … … 100 김수한무 여 951202-2 512 bytes COLLSCAN => 25 BLOCKS
  • 16. _id Point er 1 85~86 2 87~88 3 89~90 4 91~92 5 93~94 512 bytes _id 이름 성별 주민등록번 호 … … … … 4 왕배 남 812345-1 5 Duckduck 남 860907-1 3 Kelly 여 900102-2 6 Yep 남 912345-1 2 Cona 여 920907-2 1 Dana 여 940821-2 8 Won 남 9412345-1 100 김수한무 여 951202-2 7 Oak 여 9912345-2 16bytes 최대 5 Blocks
  • 17. Multi level index 1,000 rows, 250 blocks 40 blocks 4 blocks
  • 19. B tree 트리 내의 자료들은 모두 정렬된 상태 노드 내의 키들은 모두 정렬된 상태이다. K1 < k2 < k3
  • 20. B tree 하나의 노드에 최대 (M/2) - 1 개 부터 M-1 개의 키 존재 Ex : 3차 B-tree의 최소 key수는 1개, 최대 key수는 2개
  • 21. B tree 모든 리프노드가 동일한 레벨에 있음
  • 22. B tree Key 생성 프로세스는 상향식으로 이루어짐
  • 23. B tree Keys : [10,20,30,40], 4차 B-tree 10 20 30 40
  • 24. B tree Keys : [10,20,30,40], 4차 B-tree 30 40 20 10
  • 25. B tree Keys : [10,20,30,40,50,60,70,80,90,100] 4차 B-tree
  • 26. B tree Keys : [10,20,30,40], 4차 B-tree
  • 27. B tree 삽입 1. 리프노드이면서, 삽입할 노드의 key 갯수가 최대일 때 2. 리프노드이면서, 삽입할 노드의 key 갯수가 최대 미만일 때
  • 28. B tree 삭제 1. 삭제할 데이터가 리프노드에 있으면서, 최소key 갯수를 보 장할 때 2. 리프노드에 있고, 최소 key를 보장하지 않을 때 3. 리프노드에 있고, 인접한 형제 노드들이 최소 key일 때 4. 리프노드가 아니고, 최소 Key를 보장할 때 5. 리프노드가 아니고, 최소 key를 보장하지 않을 때
  • 30.