关于链表
  • 板块灌水区
  • 楼主FANTA5TlC
  • 当前回复8
  • 已保存回复8
  • 发布时间2021/10/20 08:29
  • 上次更新2023/11/4 03:12:46
查看原帖
关于链表
297798
FANTA5TlC楼主2021/10/20 08:29

rt,求问插入左/右函数的第二行为什么不是a[pos.R].L=x;a[pos.R].L = x;

inline void addRight(int x, int pos) { //插入右边 
    a[x].L = pos;
    a[a[pos].R].L = x;
    a[x].R = a[pos].R;
    a[pos].R = x;
}
inline void addLeft(int x, int pos) { //插入左边
    a[x].R = pos;
    a[a[pos].L].R = x;
    a[x].L = a[pos].L;
    a[pos].L = x;
}
2021/10/20 08:29
加载中...