【study】Leetcode中Go语言第三方包
【study】Leetcode中Go语言第三方包
在刷Leetcode时,发现Go并不像其他语言有原生的栈、队列等等结构。虽然很多操作都可以用切片或数组代替,但还是想知道如果自己想使用这些数据结构应该怎么办。
包含的数据结构如下
- Containers
- Lists
- ArrayList
- SinglyLinkedList
- DoublyLinkedList
- Sets
- HashSet
- TreeSet
- LinkedHashSet
- Stacks
- LinkedListStack
- ArrayStack
- Maps
- HashMap
- TreeMap
- LinkedHashMap
- HashBidiMap
- TreeBidiMap
- Trees
- RedBlackTree
- AVLTree
- BTree
- BinaryHeap
- Queues
- LinkedListQueue
- ArrayQueue
- CircularBuffer
- PriorityQueue
- Lists
- Functions
- Comparator
- Iterator
- IteratorWithIndex
- IteratorWithKey
- ReverseIteratorWithIndex
- ReverseIteratorWithKey
- Enumerable
- EnumerableWithIndex
- EnumerableWithKey
- Serialization
- JSONSerializer
- JSONDeserializer
- Sort
- Container
- Appendix
所有数据结构都依赖Container
接口,调用起来也很方便
以栈举例
1 |
|
更多操作可以看github中的README.md
文件或者看源码
【study】Leetcode中Go语言第三方包
https://promisewang.github.io/post/2360e101.html