Download presentation
Presentation is loading. Please wait.
Published byDontae Harrod Modified over 10 years ago
1
Lecture 11 Binary Search Tree Sandy Ardianto & Erick Pranata © Sekolah Tinggi Teknik Surabaya 1
2
» Structure » Terminology » Tree Variation » Action » Insert » Traverse » Search » Delete » Exercises 2 © Sekolah Tinggi Teknik Surabaya
3
3
4
4 5 5 3 3 8 8 2 2 4 4 9 9
5
5
6
6 Subtree 5 5 3 3 8 8 2 2 4 4 9 9 root leaf
7
© Sekolah Tinggi Teknik Surabaya 7
8
» Binary Search Tree » Ternary Search Tree » Red Black Tree » AVL Tree (Adelson-Velskii dan Landis) » etc 8 © Sekolah Tinggi Teknik Surabaya
9
9
10
» Insert » Traverse Show all elements » Search Find its element » Delete 10 © Sekolah Tinggi Teknik Surabaya
11
11
12
» If root is null ˃New node is root » Else ˃Find empty position ˃Locate New Node to there » In a binary tree, a small number will go on the left, while a large number will be entered in the right 12 © Sekolah Tinggi Teknik Surabaya
13
13
14
» Breadth First Search ˃Search Widens ˃Using Queue » Depth First Search ˃Search Depth ˃Do recursively ˃There are 3 types: +Pre-order traversal +In-order traversal +Post-order traversal 14 © Sekolah Tinggi Teknik Surabaya
15
15
16
» Done by utilizing the Traverse action. 16 © Sekolah Tinggi Teknik Surabaya
17
17
18
» Find the node to be deleted, reffered to as del_node » If del_node don’t have children, remove immediately » But if del_node had one child, point the pointer parent to a child of del_node » But if del_node had two children: ˃Option 1: find the rightmost child of the left subtree, referred to as the replacer; ˃Option 2: find the leftmost child of the right subtree, referred to as the replacer; ˃Replace del_node with replacer 18 © Sekolah Tinggi Teknik Surabaya
19
19
20
Implement Binary Search Tree in C#.NET 20 © Sekolah Tinggi Teknik Surabaya
21
» Andrew Troelsen, Pro C# and The.Net 4.5 Framework (Sixth Edition), Apress, 2012 » http://en.wikipedia.org/wiki/Binary_tre e http://en.wikipedia.org/wiki/Binary_tre e 21 © Sekolah Tinggi Teknik Surabaya
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.