Dictionaries and their Implementation: Binary Search Trees

(辞書とその実装: 二分探索木など)

Data Structures and Algorithms

8th lecture, November 21, 2019

http://www.sw.it.aoyama.ac.jp/2019/DA/lecture8.html

Martin J. Dürst

AGU

© 2009-19 Martin J. Dürst 青山学院大学

Today's Schedule

 

Leftovers of Last Lecture

 

Summary of Last Lecture

 

Sorting Faster than O(n log n)

 

Bin Sort

(also called bucket sort)

Example: Sorting by student number

Radix Sort

Bin Sort vs. Radix Sort

Bin Sort Radix Sort
Complexity O(n k) O(n k)
First digit sorted most significant digit least significant digit
Last digit sorted least significant digit most significant digit
Direction
Stable sort needed No Yes
Data partitioning needed Yes No

Parallelization of Sorting

The Dictionary ADT

(caution: Not the same as a (book) dictionary)

 

Simple Dictionary Implementations

 

Binary Tree

 

Traversal Methods for Binary Trees

 

Binary Search Tree: Invariants

 

Search in a Search Tree

 

Insertion into a Search Tree

 

Deletion from a Search Tree

 

Implementation of Search Tree

 

Evaluation of Simple Search Tree

 

Balanced Trees

Solution: A tree that is to some degree (but not perfectly) balanced

 

Top-down 2-3-4 Tree

(definition/invariants)

 

Summary

 

Homework

(no need to submit)

 

Glossary

bin sort
ビンソート
most significant digit
最上位の桁
radix sort
基数整列
least significant digit
最下位の桁
balanced tree
平衡木
traversal method
辿り方
binary search tree
二分探索木
balanced tree
平衡木
hashing
ハッシュ法
binary tree
二分木
parallelization
並列化
depth first
深さ優先
preorder
行きがけ順
inorder
通りがけ順
postorder
帰りがけ順
breadth first
幅優先
key
キー、鍵
implementation-dependent
実装依存
top-down 2-3-4 tree
トップダウン 2-3-4 木
uniform height
一定の高さ