RBTree的幾種變色和旋轉情況

RBTree的旋轉情況 大體可以分爲兩類 1. 不需要旋轉的 cur,parent,uncle爲紅 grandfather爲黑 只需要將parent,uncle變爲黑,grandfather變爲紅,這個樹便調整完畢 2. 需要左右旋轉的 (1)cur,parent爲紅,grandfather爲黑,uncle不存在或者爲黑 且parent爲grandfather左,cur爲parent左,起始樹圖:
相關文章
相關標籤/搜索