mirror of
https://github.com/krahets/hello-algo.git
synced 2024-12-26 02:06:30 +08:00
Update linked_list.md
This commit is contained in:
parent
cd9f4fc35d
commit
679d5314d9
1 changed files with 13 additions and 13 deletions
|
@ -174,19 +174,19 @@ comments: true
|
||||||
=== "Go"
|
=== "Go"
|
||||||
|
|
||||||
```go title=""
|
```go title=""
|
||||||
/* 初始化链表 1 -> 3 -> 2 -> 5 -> 4 */
|
/* 初始化链表 1 -> 3 -> 2 -> 5 -> 4 */
|
||||||
// 初始化各个结点
|
// 初始化各个结点
|
||||||
n0 := NewListNode(1)
|
n0 := NewListNode(1)
|
||||||
n1 := NewListNode(3)
|
n1 := NewListNode(3)
|
||||||
n2 := NewListNode(2)
|
n2 := NewListNode(2)
|
||||||
n3 := NewListNode(5)
|
n3 := NewListNode(5)
|
||||||
n4 := NewListNode(4)
|
n4 := NewListNode(4)
|
||||||
|
|
||||||
// 构建引用指向
|
// 构建引用指向
|
||||||
n0.Next = n1
|
n0.Next = n1
|
||||||
n1.Next = n2
|
n1.Next = n2
|
||||||
n2.Next = n3
|
n2.Next = n3
|
||||||
n3.Next = n4
|
n3.Next = n4
|
||||||
```
|
```
|
||||||
|
|
||||||
=== "JavaScript"
|
=== "JavaScript"
|
||||||
|
|
Loading…
Reference in a new issue