just-react icon indicating copy to clipboard operation
just-react copied to clipboard

关于极简react的Demo的问题

Open blazer233 opened this issue 4 years ago • 2 comments

// 环状单向链表操作
  if (queue.pending === null) {
    update.next = update;
  } else {
    update.next = queue.pending.next;
    queue.pending.next = update;
  }
  queue.pending = update;

既然queue.pending保存着上个update,next指向自己,是否也可写为

...
  } else {
    update.next = queue.pending;
    queue.pending.next = update;
  }
...

blazer233 avatar May 06 '21 08:05 blazer233

按后一种写法3个节点及以上无法形成正确的环

BetaSu avatar May 06 '21 10:05 BetaSu

按后一种写法3个节点及以上无法形成正确的环

谢谢大佬

blazer233 avatar May 06 '21 11:05 blazer233