Please enable JavaScript.
Coggle requires JavaScript to display documents.
D.S (Tree (Advance tree (支援 double-end priority queue (皆支援操作 (delete max,…
D.S
Tree
Advance tree
-
-
m-way search tree
-
-
B-tree of order m
If not empty, root 的degree 在2到 m
除了 root 即Failure Node之外,其餘的Node degree 在 2/m <= degree <= m
-
-
-
Red-Black Tree
定義
balanced B.S.T, balanced B.S.T, if not empty
-
-
root 到不同leaf 之 Path 上,皆具有相同的黑色nodes(balanced)
Horowitz 版本
是 2-3-4 Tree, 對應的 BST,滿足
若此Link在 2-3-4 Tree 已存在,則視為黑link,,否則為紅link
-
-
-
-
Optimal B.S.T
定義
n個內部node,加權值,令為Pi , 1<=i<=n
n+1個外部node,加權值,令為 qi,0<=i<=n
-
-
Leftist Heap
Shortest(x) Path
-
1+ min(Shortest(x->left,x->right))
-
-
Binomial Heap
Binomial tree
令root 的level為0
Bk:代表k高度的binomial tree,是由兩個高的為k-1的Bk-1所組成,任一個bk-1為new root , root , 另一棵bk-1為其子樹
B0:代表高度為0 的 Binomial tree, 只有root一個點
-
由一群binomial tree 組成之集合 (Forest),且必須為min-tree
-
-
二元樹
定義與樹的差異(三個)
-
差異:二元樹可為空,0<=Node's Degredd<=2 , 0<=Node's Degredd<=2 , 子樹有方向性
基本定理(三個)
高度為k之B.T,最多Node數 = (2的k次方)-1
針對非空之B.T令Leaf 個數為No個, Degree 為2之Node數 為 n0 = n2+1
-
-
-
-
-
樹的表示方法(四種)
化成二元樹
方法
刪除父點與子點連結,但是保留the leftest node
-
-
-
-
-
-
樹的定義
-
-
其餘node T1~Tn個互斥集合,稱為 Root的子樹
-
Disjoint Set
-
應用
Kruskal's algo 求 min ,spanning tree,判斷邊(i,j)加入S中是否會形成Cycle
-
-
-
Ordering
Search Tree
Binary Search Tree
-
-
sorting
需決定值相同的Data要放在何處
-
-
結構受input order 影響 , 可能變 skewed Tree
操作
delete
degree = 2 node
挑選最左邊最大之節點或最右邊最小節點取代父點,視原本節點為 leaf或 degree-1之節點 依照case1 or case2處理
-
-
Balanced BST
AVL tree
if not empty, 左右子樹高度不能高過一
-
-
-
-
-
-
-
-
-
Graph
-
-
shortest path problem
Bellman-Ford
允許有負邊,但不能有negative length of cycle
-
-
-
-
Spanning tree
Def: 給予Connected無向圖G=(V,E),,令S=(V,T),T)為G的一個Spanning Tree,則滿足:
-
在S中,任何頂點對之間,只存在一條simple path
E = T+B (Tree edge,Back edge)
-
BasicConcept
-
-
常考題型
-
AsymptoticNotation 定義,大小,定理
-
-
-
-
-
-
-
Hashing
定義
Data 儲存與搜尋機制,欲取出data前必須先經過hashing function 求出 Hashing address , 到對應的hash Bucket 取出data
Terminology
Hash Table
是由B個bucket,每個bucket有S個Slot所組成
-
-
-
-
Hashing Function Design
-
-
Overflow的處理方式
-
-
Qrodratic Probing
-
-
易發生secondary clustering 現象, 增加searching time
-
Linear Probing
-
容易有primary clustering, 及相同hashing address 會儲存在附近的bucket中,增加searching time
-
Sort
Comparison Base
-
-
-
Select Sort
自第 i 筆到 n ,select min 與 A[i] 做swap
-
-
-
-
HeapSort
-
Best,Avg,Worst : O(nlogn)
-
-
-
Linear sorting
-
-
Redix Sort
LSD radix sort
O(d*(n+r)) d:回合, n:data, n:data數, r:bucket數
-
-