💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
[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 ```