1. Trang chủ
  2. » Công Nghệ Thông Tin

Data Structures and Algorithms - Chapter 12: Multiway trees pdf

44 492 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Multiway Trees
Chuyên ngành Data Structures and Algorithms
Thể loại Lecture Notes
Định dạng
Số trang 44
Dung lượng 793,7 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Lexicographic Search Tree8... M-Way Search Tree12... B_Node count data branch... B-Tree SeachTree22 SearchTree ref target 1.. return recursiveSearchTree root , target End SearchTre

Trang 1

Chapter 12

 Lexicographic Search Trees: Tries

 Multiway Trees

 B-Tree, B*-Tree, B+-Tree

 Red-Black Trees (BST and B-Tree)

 2-d Tree, k-d Tree

1

Trang 2

Basic Concepts

2

Trang 3

Basic Concepts

3

Trang 4

4

Trang 6

Trees and Orchard

6

Trang 8

Lexicographic Search Tree

8

Trang 9

Multiway Trees

9

Trang 10

10

Trang 12

M-Way Search Tree

12

Trang 16

16

Trang 18

B-Tree Insertion

18

Trang 19

B-Tree Insertion

19

Trang 20

B_Node

count <integer>

data <array of <DataType>>

branch <array of <pointer>>

Trang 21

Methods and Functions

Trang 22

B-Tree SeachTree

22

<ErrorCode> SearchTree (ref target <DataType>)

1 return recursiveSearchTree ( root , target )

End SearchTree

Trang 23

B-Tree SeachTree

23

<ErrorCode> recursiveSearchTree (val subroot <pointer>,

ref target <DataType>)

1 result = not_present

2 if (subroot is not NULL)

1 result = SearhNode ( subroot, target , position)

Trang 24

B-Tree SeachTree

24

<ErrorCode> SearchNode (val subroot <pointer>,

val target <DataType>, ref position <integer>)

1 position = 0

2 loop (position < subroot->count ) AND ( target > subroot->dataposition)

1 position = position + 1 // Sequential Search

3 if (position < subroot->count ) AND ( target = subroot->dataposition)

1 return success

4 else

1 return not_present

End SearchNode

Trang 25

Methods and Functions

Trang 26

B-Tree Insertion

26

<ErrorCode> Insert (val newData <DataType>)

(local variable: median <DataType>, rightBranch <pointer>,

newroot <pointer>, result <ErrorCode> )

Return duplicate_error, success

1 result = recursiveInsert ( root , newData, median, rightBranch)

2 if (result = overflow)

1 Allocate newroot

2 newroot-> count = 1

3 newroot-> data0 = median

4 newroot-> branch0 = root

5 newroot-> branch1 = rightBranch

6 root = newroot

7 result = success

3 return result

End Insert

Trang 27

Split Node

27

Trang 28

B-Tree Insertion

28

<ErrorCode> recursiveInsert (val subroot <pointer>,

val newData <DataType>,ref median <DataType>,ref rightBranch <pointer>)

Return overflow, duplicate_error, success

Trang 29

<ErrorCode> recursiveInsert (val subroot <pointer>,

val newData <DataType>, ref median <DataType>, ref rightBranch <pointer>) (cont.)

2 // else, local variables: extraEntry, extraBranch

1 if (SearchNode ( subroot , newData , position) = success)

Trang 30

Push In

30

Trang 31

31

<void> push_in (val subroot <pointer>,

val entry <DataType>,val rightBranch <pointer>, val position <integer>)

1 i = subroot -> count

1 subroot -> datai = subroot -> datai - 1

2 subroot -> branchi + 1 = subroot -> branchi

3 i = i + 1

3 subroot -> data position= entry

4 subroot -> branch position + 1= rightBranch

5 subroot -> count = - subroot -> count + 1

End push_in

Trang 32

32

<void> splitNode (val subroot <pointer>,

val extraEntry <DataType>,val extraBranch <pointer>, val position <integer>,

ref rightHalf <pointer>,ref median <DataType>)

Trang 33

B-Tree Insertion

33

Trang 34

B-Tree Insertion

34

Trang 36

B-Tree Deletion

36

Trang 37

B-Tree Deletion

37

Trang 38

B-Tree Deletion

38

Trang 44

k-d Trees

 2-d Tree

 k-d Tree

44

Ngày đăng: 15/03/2014, 17:20

TỪ KHÓA LIÊN QUAN