Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
cvvz committed Dec 23, 2021
1 parent 95338df commit f55dc14
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions content/post/data-structure-and-algorithm.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ tags: ["code", "golang"]

很多高级语言都基于基础的数组实现了**动态数组**,比如Java中的ArrayList、C++ STL中的vector和golang中的slice,动态数组的优势在于可以动态扩容,使用起来很方便,**在实现算法时更加handy**。但是由于封装了额外的数据迁移等操作,时间效率上不如数组高。

技巧:双指针
🌟**技巧:使用双指针求两数之和**

### 链表

### 单链表、双链表、循环链表

技巧:**使用哨兵节点(带头链表)**。这样在插入第一个节点和删除最后一个节点时,就不需要做特殊判断,可以简化实现逻辑
🌟**技巧:使用哨兵节点简化插入和删除节点的逻辑。**

> 所有高级数据结构都是在数组和链表的基础上衍生出来的。
Expand Down
7 changes: 5 additions & 2 deletions content/post/design-pattern.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ tags: ["golang", "coding"]

4. 不要在函数中使用布尔类型的标识参数来控制内部逻辑,true 的时候走这块逻辑,false 的时候走另一块逻辑。

## 设计模式(基于golang)
## golang设计模式

> 创建型:主要解决“对象的创建”问题
>
Expand All @@ -120,5 +120,8 @@ tags: ["golang", "coding"]
* [工厂](https://github.com/cvvz/go-design-pattern/tree/master/golang/factory)
* [建造者](https://github.com/cvvz/go-design-pattern/tree/master/golang/builder)
2. 结构型
* [装饰器/Functional Option](https://github.com/cvvz/go-design-pattern/tree/master/golang/decorator)
3. 行为型

## 拓展:golang常用编程模式

* [Functional Option](https://github.com/cvvz/go-design-pattern/tree/master/golang/decorator)

0 comments on commit f55dc14

Please sign in to comment.