Skip to content

Files

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
·
19 lines (11 loc) · 389 Bytes

File metadata and controls

executable file
·
19 lines (11 loc) · 389 Bytes

链表遍历

我们的任务是顺序遍历给定的链表

比如下面的链表

Singly linked list

遍历的顺序应该是

12 → 99 → 37

因为我们每个节点只访问一次,时间复杂度应该是O(n)

参考