mirror of
https://github.com/krahets/hello-algo.git
synced 2026-03-30 16:52:29 +08:00
Change the operations sequence of the likedlist's insert() method.
This commit is contained in:
@@ -8,8 +8,8 @@ const inc = @import("include");
|
||||
// 在链表的结点 n0 之后插入结点 P
|
||||
pub fn insert(n0: ?*inc.ListNode(i32), P: ?*inc.ListNode(i32)) void {
|
||||
var n1 = n0.?.next;
|
||||
n0.?.next = P;
|
||||
P.?.next = n1;
|
||||
n0.?.next = P;
|
||||
}
|
||||
|
||||
// 删除链表的结点 n0 之后的首个结点
|
||||
|
||||
Reference in New Issue
Block a user