Âng-o͘-chhiū
Guā-māu
Âng-o͘-chhiū (Eng-gí: red-black tree) sī chi̍t khoán jī-hun so͘-sek-chhiū (binary search tree), te̍k-sek sī khài-liām siōng bí chi̍t chiat node hâm chi̍t-ê sek-tī ê sèng-chit, thang sī âng-sek he̍k-chiá o͘-sek siang khoán kî-tiong chi it. Lī-ēng tùi node sek-tī ê hàn-chè, ē-tàng hō͘ jīn-hô chi̍t tiâu kin-pō͘ (root) kòe hio̍h-pō͘ (leaf) ê lō͘-kèng mài chhiau-kòe pa̍t tiâu lō͘ ê siang pōe tn̂g, î-chhî chhiū tāi-khài ê pêng-kin hoat-tián.
Sèng-chit
[siu-kái | kái goân-sí-bé]![](http://upload.wikimedia.org/wikipedia/commons/thumb/6/66/Red-black_tree_example.svg/220px-Red-black_tree_example.svg.png)
Âng-o͘-chhiū sī boán-chio̍k í-hā sèng-chit ê jī-hun so͘-sek-chhiū:
- Ta̍k-ê node sī âng-sek he̍k-chiá o͘-sek chi it.
- Kun-pō͘ sī o͘-sek--ê.
- Ta̍k-ê hio̍h-pō͘ (NIL) sī o͘-sek--ê.
- Nā bó͘ chi̍t-ê node sī âng-sek--ê, i-ê nn̄g-ê gín-á (chiap--chhut-lâi ê ē-chân) ài sī o͘-sek--ê.
- Bí chi̍t-ê node, bí chi̍t tiâu tùi hit-ê node thàng kàu chiap āu hio̍h-po͘ ê tan-sûn lō͘-kèng (simple path), in tang-tiong ê o͘-sek node sò͘-liōng sī sio-siâng--ê.
Chham-khó
[siu-kái | kái goân-sí-bé]- Cormen, Thomas H.; Leiserson, Charles E; Rivest, Ronald L; Stein, Clifford (2009). Introduction to Algorithms (Tē-3 pán.). The MIT Press. ISBN 9780262259460.
![]() | Pún bûn-chiuⁿ sī chi̍t phiⁿ phí-á-kiáⁿ. Lí thang tàu khok-chhiong lâi pang-chō͘ Wikipedia. |