版本比较
浅谈红黑树
正文
增加 8 行删除 8 行
101 行未改动全部展开10210310410510610610710810911041 行未改动152153154155156156157158159160113 行未改动全部展开274275276277278278279280281282152 行未改动全部展开43543643743843943944044144244395 行未改动53954054154254354354454554654723 行未改动57157257357457557557657757857964 行未改动64464564664764864864965065165247 行未改动70070170270370470470570670770834 行未改动101 行未改动全部展开 if(t[o].v>v){ res=t[o].v, o=t[o].ch[0]; } else else o=t[o].ch[1]; } return res;}41 行未改动 t[t[s1].ch[c]].fa=o; t[s1].fa=t[o].fa; if(!t[o].fa) rt=s1; else else t[t[o].fa].ch[get(o)]=s1; t[s1].ch[c]=o; t[o].fa=s1; pushup(o);113 行未改动全部展开}void ins(int v) { int o=rt,f=0; while(o){ t[o].sz++,f=o; t[o].sz++,f=o; if(v==t[o].v){ t[o].cnt++; return; }152 行未改动全部展开 while(o&&t[o].v!=v){ o=t[o].ch[t[o].v<v]; } if(!o)return; if(t[o].cnt>1) { if(t[o].cnt>1) { t[o].cnt--; update(o); return; }95 行未改动 t[t[s1].ch[c]].fa=o; t[s1].fa=t[o].fa; if(!t[o].fa) rt=s1; else else t[t[o].fa].ch[get(o)]=s1; t[s1].ch[c]=o; t[o].fa=s1; pushup(o);23 行未改动}void ins(int v) { int o=rt,f=0; while(o){ t[o].sz++,f=o; t[o].sz++,f=o; if(v==t[o].v){ t[o].cnt++; return; }64 行未改动 while(o&&t[o].v!=v){ o=t[o].ch[t[o].v<v]; } if(!o)return; if(t[o].cnt>1) { if(t[o].cnt>1) { t[o].cnt--; update(o); return; }47 行未改动 if(t[o].v>v){ res=t[o].v, o=t[o].ch[0]; } else else o=t[o].ch[1]; } return res;}34 行未改动