多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
[TOC] ## 遍历 前序和后续遍历在对链表做操作时,可以有助于理解 ### 前序 ``` func iter(head *Node) { if head == nil || head.next == nil { return } fmt.Printf("%+v\n", head.val) iter(head.next) } //output //1 //2 //3 //4 //5 ``` ### 后续 ``` func iter(head *Node) { if head == nil || head.next == nil { return } iter(head.next) fmt.Printf("%+v\n", head.val) } //output //5 //4 //3 //2 //1 ```