SlideShare ist ein Scribd-Unternehmen logo
1 von 36
Disusun Oleh
Elen Riswana Safila Putri
H92219048
L TREE AVL TREE AVL TR
Definition?
AVL Tree adalah Binary Search Tree dengan selisih tinggi cabang kiri dan cabang kanan
maksimal satu.
AVL Tree muncul untuk menyeimbangkan Binary Search Tree. Dengan AVL Tree, waktu
pencarian dan bentuk tree dapat dipersingkat dan disederhanakan.
SELF BALANCING TREE
Untuk menjaga tree tetap imbang, setelah penyisipan sebuah node dilakukan
pemeriksaan dari node baru ke root.
Node pertama yang memiliki |balance factor| > 1 harus diseimbangkan.
Proses penyeimbangan dilakukan dengan Single rotation atau Double rotation
Balance Factor = height(left subtree) - height(right
subtree)
SELF BALANCING TREE
Balance Factor = height(left subtree) - height(right
subtree)
9
5
3 6
15
11 21
2 18 23
2016
3 – 4 = -1
2 – 1 = 1
1 – 0 = 1
0-0=0
13
2 – 3 = -1
2 – 1 = 1
0 – 0 = 0
1 – 1 = 0
0-1 = -1
0-0=0
0-0=0 0-0=0
0-0=0
AVL TREE
12
192
5
AVL Tree
Bukan AVL Tree
AVL Tree
Bukan AVL Tree
Karena bukan
BST
Karena memiliki ketinggian lebih dari satu
12
92
5
192
5
12
192
5
14
AVL TREE
OPERATION
1.Insertion
2. Deletion
Insertion
penyisipan seperti dalam binary search tree yang selalu dilakukan
dengan memperluas node eksternal
• Sisipkan node baru sebagai leaf
• Seimbangkan node pada path
Beberapa ketidakseimbangan, yaitu
1. Left left case
2. Right right case
3. Right left case
4. Left right case
• Tree seimbang
Algoritma Insertion AVL Tree
12
25
9 72
49
35
62
69
50
32
29
35
Case 1
Case 3
case 2
case 4
Case Solution Case Solution Case Solution
Pemecahan kasus ketidakseimbangan dilakukan dengan
• SINGLE ROTATION
Penyeimbangan tree dengan merotasi tree sebanyak satu rotasi pada posisi root.
Diterapkan pada kasus Left left case dan Right right case
• DOUBLE ROTATION
Penyeimbangan tree dengan merotasi tree sebanyak dua rotasi.
Diterapkan pada kasus Left right case dan Right left case
Case Solution Case Solution Case Solution
SINGLE ROTATION
v
1. Left Left Case
Setelah disisipkan z dan sub tree 4, terjadi ketidakseimbangan pada subtree kiri (y) dan child kiri (x )
Maka cukup melakukan right rotation
Ilustrasi
T4y
z
x
T2
T3
y
x z
↓T1
T1 T2 T4T3
example
Creat an AVL Tree by inserting 2 to the following values in the order given :
10
7 15
4 2313
• Masukkan 2 dalam tree
• Tree seimbang
Tahapan
10
4
2 7
15
13 23
157
10
4
2
13 23
↓
Hasil :
• Lakukan right rotation
SINGLE ROTATION
2. Right Right Case
Setelah disisipkan, terjadi ketidakseimbangan pada subtree kanan (y) dan child kanan (x )
Maka cukup melakukan left rotation
Ilustrasi
y
z
T1 T2
x
T3 T4
yT1
z
T2 x
T3 T4
↓
v
example
Creat an AVL Tree by inserting 15 and 25 to the following values in the order given :
30
28 40
33 54
• Tree seimbang
Tahapan
• Masukkan 15 dan 25 dalam tree
15
↓
Hasil :
30
28 40
33 54
25 30
25
15 28
40
33 54
• Lakukan left rotation
DOUBLE ROTATION
v
3. Right Left Case
Setelah dilakukan penyisipan, terjadi ketidakseimbangan pada subtree kanan (y) dan child kiri (x)
Maka dilakukan right rotation dan di lanjutkan left rotation
Ilustrasi
x
z y
↓
T1 T2 T4T3
↓
yT1
z
x
T3
T4
T2
xT1
z
T2
T4
y
T3
example
5 6742 1 1693 15
Creat an AVL Tree by inserting the following values in the order given :
• Tree seimbang
Tahapan
↓
5
2
1 4
7
6 9
3
15
16
5
2
1 4
7
6 9
3
16
15
• Buat tree
• Lakukan right rotation dilanjutkan left rotation
• Buat tree
• Lakukan right rotation dilanjutkan left rotation
• Tree seimbang
Tahapan
5
2
1 4
7
6 15
3 9 16
Hasil :
DOUBLE ROTATION
v
4. Left Right Case
Setelah dilakukan penyisipan, terjadi ketidakseimbangan pada subtree kiri (y) dan child kanan (x)
Maka dilakukan right rotation dan di lanjutkan left rotation
Ilustrasi
x
z y
↓
T1 T2 T4T3
T4y
z
T2 T3
xT1
T4x
z
y
T1 T2
T3
↓
example
Creat an AVL Tree by inserting 13 and 15 to the following values in the order given :
2418
20
129
Tahapan
2413
20
15
9 12
18
↓
2413
20
12 18
159
• Masukkan 13 dan 15 ke dalam tree
• Lakukan left rotation dilanjutkan right rotation
• Masukkan 13 dan 15 ke dalam tree
• Lakukan left rotation dilanjutkan right rotation
Tahapan
Hasil :
13
15
9 12
20
18 24
• Tree seimbang
Deletion
penghapusan seperti dalam binary search tree dimana simpul yang
dihapus menjadi simpul eksternal kosong
• Hapus node
Terjadi tiga kasus dalam penghapusan sebuah node
1. Jika node memiliki balance factors 0
2. Jika node memiliki balance factors 1
3. Jika node memiliki balance factors -1
• dicek kembali keseimbangan tree
Jika tree belum seimbang maka harus diseimbangkan kembali. Memiliki kasus
ketidakseimbangan yang sama dengan insertion
• Tree seimbang
Algoritma Deletion AVL Tree
example
FIRST CASE
Case 1 : Balance factors 0, node dihapus adalah leaf, maka hanya perlu langsung menghapus.
Delete node 38 in the following tree :
50
27
20 30
65
70
28
55
34
38
10 68 82
• Hapus 38 dalam tree
Tahapan
50
25
20 30
65
70
28
55
3410 68 92
50
27
20 30
65
70
28
55
34
38
10 68 92
↓
Hasil :
• Tree seimbang
example
SECOND CASE
50
27
20 30
65
70
28
55
34
38
10 68 82
Delete node 34 in the following tree :
Case 2 : Balance factors 1, Node yang dihapus memiliki child maka childnya yang menggantikannya.
• Tree seimbang
Tahapan
50
25
20 30
65
70
28
55
3810 68 92
50
27
20 30
65
70
28
55
34
38
10 68 92
↓
Hasil :
• Hapus 34 dalam tree
• Posisi node yang dihapus digantikan child
yaitu 38
example
THIRD CASE
Delete node 50 in the following tree :
Balance Factors -1, node yang dihapus memiliki beberapa child maka pergantian secara rekursif
50
40
20 45
68
70
42
60
48
49
10
69 8225
Tahapan
↓
Hasil : 49
25
15 40
65
70
30
55
4510
68 9220
• Tree seimbang
50
40
20 45
68
70
42
60
49
10
69 8225 48
• Hapus 50 dalam tree
• Posisi node yang dihapus digantikan child yaitu 49
Rexampl
e THIRD CASE
Delete node 60 in the following tree :
50
25
20 40
60
55 65
30
70
45
42
10
Tahapan
↓
• Hapus 60 dalam tree
• Posisi node yang dihapus digantikan child yaitu 55
• Lakukan single rotation case 2
50
25
20 40
55
60 65
30
70
45
42
10
50
25
20 40
65
70
30
55
45
42
10
• Hapus 60 dalam tree
• Posisi node yang dihapus digantikan child yaitu 55
• Lakukan single rotation case 2
• Cek perbedaan tinggi kembali
• Lakukan double rotation case 4
50
25
20 40
65
70
30
55
45
42
10
↓
50
40
25 45
65
70
42
55
20
10
30
40
25
20 30
50
65
42
45
10 55 70
Hasil :
• Hapus 60 dalam tree
• Posisi node yang dihapus digantikan child yaitu 55
• Lakukan single rotation case 2
• Cek perbedaan tinggi kembali
• Lakukan double rotation case 4
• Tree seimbang
Terima kasih
Terima kasih
Terima kasih
Terima kasih
Terima kasih
Terima kasih
Terima kasih
Terima kasih
Terima kasih

Weitere ähnliche Inhalte

Empfohlen

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 HubspotMarius Sescu
 
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 ChatGPTExpeed Software
 
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 EngineeringsPixeldarts
 
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 HealthThinkNow
 
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.pdfmarketingartwork
 
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
 

Empfohlen (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...
 

Penyeimbangan Tree dengan AVL Tree - Pemograman

  • 1. Disusun Oleh Elen Riswana Safila Putri H92219048 L TREE AVL TREE AVL TR
  • 2. Definition? AVL Tree adalah Binary Search Tree dengan selisih tinggi cabang kiri dan cabang kanan maksimal satu. AVL Tree muncul untuk menyeimbangkan Binary Search Tree. Dengan AVL Tree, waktu pencarian dan bentuk tree dapat dipersingkat dan disederhanakan.
  • 3. SELF BALANCING TREE Untuk menjaga tree tetap imbang, setelah penyisipan sebuah node dilakukan pemeriksaan dari node baru ke root. Node pertama yang memiliki |balance factor| > 1 harus diseimbangkan. Proses penyeimbangan dilakukan dengan Single rotation atau Double rotation Balance Factor = height(left subtree) - height(right subtree)
  • 4. SELF BALANCING TREE Balance Factor = height(left subtree) - height(right subtree) 9 5 3 6 15 11 21 2 18 23 2016 3 – 4 = -1 2 – 1 = 1 1 – 0 = 1 0-0=0 13 2 – 3 = -1 2 – 1 = 1 0 – 0 = 0 1 – 1 = 0 0-1 = -1 0-0=0 0-0=0 0-0=0 0-0=0
  • 5. AVL TREE 12 192 5 AVL Tree Bukan AVL Tree AVL Tree Bukan AVL Tree Karena bukan BST Karena memiliki ketinggian lebih dari satu 12 92 5 192 5 12 192 5 14
  • 7. Insertion penyisipan seperti dalam binary search tree yang selalu dilakukan dengan memperluas node eksternal
  • 8. • Sisipkan node baru sebagai leaf • Seimbangkan node pada path Beberapa ketidakseimbangan, yaitu 1. Left left case 2. Right right case 3. Right left case 4. Left right case • Tree seimbang Algoritma Insertion AVL Tree 12 25 9 72 49 35 62 69 50 32 29 35 Case 1 Case 3 case 2 case 4
  • 9. Case Solution Case Solution Case Solution Pemecahan kasus ketidakseimbangan dilakukan dengan • SINGLE ROTATION Penyeimbangan tree dengan merotasi tree sebanyak satu rotasi pada posisi root. Diterapkan pada kasus Left left case dan Right right case • DOUBLE ROTATION Penyeimbangan tree dengan merotasi tree sebanyak dua rotasi. Diterapkan pada kasus Left right case dan Right left case Case Solution Case Solution Case Solution
  • 10. SINGLE ROTATION v 1. Left Left Case Setelah disisipkan z dan sub tree 4, terjadi ketidakseimbangan pada subtree kiri (y) dan child kiri (x ) Maka cukup melakukan right rotation Ilustrasi T4y z x T2 T3 y x z ↓T1 T1 T2 T4T3
  • 11. example Creat an AVL Tree by inserting 2 to the following values in the order given : 10 7 15 4 2313
  • 12. • Masukkan 2 dalam tree • Tree seimbang Tahapan 10 4 2 7 15 13 23 157 10 4 2 13 23 ↓ Hasil : • Lakukan right rotation
  • 13. SINGLE ROTATION 2. Right Right Case Setelah disisipkan, terjadi ketidakseimbangan pada subtree kanan (y) dan child kanan (x ) Maka cukup melakukan left rotation Ilustrasi y z T1 T2 x T3 T4 yT1 z T2 x T3 T4 ↓ v
  • 14. example Creat an AVL Tree by inserting 15 and 25 to the following values in the order given : 30 28 40 33 54
  • 15. • Tree seimbang Tahapan • Masukkan 15 dan 25 dalam tree 15 ↓ Hasil : 30 28 40 33 54 25 30 25 15 28 40 33 54 • Lakukan left rotation
  • 16. DOUBLE ROTATION v 3. Right Left Case Setelah dilakukan penyisipan, terjadi ketidakseimbangan pada subtree kanan (y) dan child kiri (x) Maka dilakukan right rotation dan di lanjutkan left rotation Ilustrasi x z y ↓ T1 T2 T4T3 ↓ yT1 z x T3 T4 T2 xT1 z T2 T4 y T3
  • 17. example 5 6742 1 1693 15 Creat an AVL Tree by inserting the following values in the order given :
  • 18. • Tree seimbang Tahapan ↓ 5 2 1 4 7 6 9 3 15 16 5 2 1 4 7 6 9 3 16 15 • Buat tree • Lakukan right rotation dilanjutkan left rotation
  • 19. • Buat tree • Lakukan right rotation dilanjutkan left rotation • Tree seimbang Tahapan 5 2 1 4 7 6 15 3 9 16 Hasil :
  • 20. DOUBLE ROTATION v 4. Left Right Case Setelah dilakukan penyisipan, terjadi ketidakseimbangan pada subtree kiri (y) dan child kanan (x) Maka dilakukan right rotation dan di lanjutkan left rotation Ilustrasi x z y ↓ T1 T2 T4T3 T4y z T2 T3 xT1 T4x z y T1 T2 T3 ↓
  • 21. example Creat an AVL Tree by inserting 13 and 15 to the following values in the order given : 2418 20 129
  • 22. Tahapan 2413 20 15 9 12 18 ↓ 2413 20 12 18 159 • Masukkan 13 dan 15 ke dalam tree • Lakukan left rotation dilanjutkan right rotation
  • 23. • Masukkan 13 dan 15 ke dalam tree • Lakukan left rotation dilanjutkan right rotation Tahapan Hasil : 13 15 9 12 20 18 24 • Tree seimbang
  • 24. Deletion penghapusan seperti dalam binary search tree dimana simpul yang dihapus menjadi simpul eksternal kosong
  • 25. • Hapus node Terjadi tiga kasus dalam penghapusan sebuah node 1. Jika node memiliki balance factors 0 2. Jika node memiliki balance factors 1 3. Jika node memiliki balance factors -1 • dicek kembali keseimbangan tree Jika tree belum seimbang maka harus diseimbangkan kembali. Memiliki kasus ketidakseimbangan yang sama dengan insertion • Tree seimbang Algoritma Deletion AVL Tree
  • 26. example FIRST CASE Case 1 : Balance factors 0, node dihapus adalah leaf, maka hanya perlu langsung menghapus. Delete node 38 in the following tree : 50 27 20 30 65 70 28 55 34 38 10 68 82
  • 27. • Hapus 38 dalam tree Tahapan 50 25 20 30 65 70 28 55 3410 68 92 50 27 20 30 65 70 28 55 34 38 10 68 92 ↓ Hasil : • Tree seimbang
  • 28. example SECOND CASE 50 27 20 30 65 70 28 55 34 38 10 68 82 Delete node 34 in the following tree : Case 2 : Balance factors 1, Node yang dihapus memiliki child maka childnya yang menggantikannya.
  • 29. • Tree seimbang Tahapan 50 25 20 30 65 70 28 55 3810 68 92 50 27 20 30 65 70 28 55 34 38 10 68 92 ↓ Hasil : • Hapus 34 dalam tree • Posisi node yang dihapus digantikan child yaitu 38
  • 30. example THIRD CASE Delete node 50 in the following tree : Balance Factors -1, node yang dihapus memiliki beberapa child maka pergantian secara rekursif 50 40 20 45 68 70 42 60 48 49 10 69 8225
  • 31. Tahapan ↓ Hasil : 49 25 15 40 65 70 30 55 4510 68 9220 • Tree seimbang 50 40 20 45 68 70 42 60 49 10 69 8225 48 • Hapus 50 dalam tree • Posisi node yang dihapus digantikan child yaitu 49
  • 32. Rexampl e THIRD CASE Delete node 60 in the following tree : 50 25 20 40 60 55 65 30 70 45 42 10
  • 33. Tahapan ↓ • Hapus 60 dalam tree • Posisi node yang dihapus digantikan child yaitu 55 • Lakukan single rotation case 2 50 25 20 40 55 60 65 30 70 45 42 10 50 25 20 40 65 70 30 55 45 42 10
  • 34. • Hapus 60 dalam tree • Posisi node yang dihapus digantikan child yaitu 55 • Lakukan single rotation case 2 • Cek perbedaan tinggi kembali • Lakukan double rotation case 4 50 25 20 40 65 70 30 55 45 42 10 ↓ 50 40 25 45 65 70 42 55 20 10 30
  • 35. 40 25 20 30 50 65 42 45 10 55 70 Hasil : • Hapus 60 dalam tree • Posisi node yang dihapus digantikan child yaitu 55 • Lakukan single rotation case 2 • Cek perbedaan tinggi kembali • Lakukan double rotation case 4 • Tree seimbang
  • 36. Terima kasih Terima kasih Terima kasih Terima kasih Terima kasih Terima kasih Terima kasih Terima kasih Terima kasih