datastructures-swift Swift数据结构库

Swift 开发的日常里,数据结构其实用得还挺多,是搞 iOS 的同学经常绕不开列表、队列这些玩意儿。datastructures-swift就是专门为 Swift 开发者准备的一个开源仓库,里面实现了多常用数据结构,写得清晰,用起来方便,还鼓励一起贡献代码,挺适合拿来练手或者做参考的。

数组、链表、栈、队列这些基础结构都有,甚至还包含了像树、图、堆这种稍微进阶一点的。比如你要做个消息缓存系统,用自定义的QueueArray更合适,操作简单,性能也更稳。

链表也挺实用,尤其在需要频繁插入和删除的场景,比如动态加载聊天记录的时候,链表就比数组灵活多了。顺手贴个文章你可以参考下Swift 数据结构:链表

还有像Stack,做界面跳转回退的时候用得上,Heap能拿来做优先级,Tree常常在构建层级结构的视图时派上用场,比如文件管理器或者侧边栏导航。

每个结构不仅有代码实现,还有对应的测试和使用示例,照着学蛮方便的。你要是想动手写点东西优化它,也完全可以提个 PR,说不定还能跟别的 iOS 开发者交流下思路。

如果你正在学习 Swift,或者平时做项目老碰到“哪个结构性能更好”这种问题,那这个仓库可以说是个不错的工具箱,随时翻一翻,说不定就灵感来了。

zip
datastructures-swift-master.zip 预估大小:72个文件
folder
datastructures-swift-master 文件夹
folder
BubbleSort.playground 文件夹
file
Contents.swift 488B
file
contents.xcplayground 165B
folder
Factorial.playground 文件夹
file
Contents.swift 670B
file
contents.xcplayground 165B
folder
FibonacciSeries.playground 文件夹
file
Contents.swift 990B
file
contents.xcplayground 165B
folder
Array.playground 文件夹
file
Contents.swift 2KB
file
contents.xcplayground 165B
folder
DoublyLinkedList.playground 文件夹
file
Contents.swift 4KB
file
contents.xcplayground 165B
folder
Queue 文件夹
folder
QueueUsingLinkedList.playground 文件夹
file
Contents.swift 2KB
file
contents.xcplayground 165B
folder
QueueUsingArray.playground 文件夹
file
Contents.swift 754B
file
contents.xcplayground 165B
folder
QueueUsingStacks.playground 文件夹
file
Contents.swift 2KB
file
contents.xcplayground 165B
folder
HashTable.playground 文件夹
file
Contents.swift 4KB
file
contents.xcplayground 165B
folder
OOPs.playground 文件夹
file
Contents.swift 2KB
file
contents.xcplayground 165B
folder
BracketsProblem.playground 文件夹
file
Contents.swift 853B
file
contents.xcplayground 165B
folder
StringReversal.playground 文件夹
file
Contents.swift 754B
file
contents.xcplayground 165B
file
LICENSE 1KB
folder
BinaryTree.playground 文件夹
file
Contents.swift 2KB
file
contents.xcplayground 165B
folder
Stack 文件夹
folder
StackusingLinkedList.playground 文件夹
file
Contents.swift 2KB
file
contents.xcplayground 165B
folder
StackUsingArray.playground 文件夹
file
Contents.swift 1KB
file
contents.xcplayground 165B
folder
LinkedList.playground 文件夹
file
Contents.swift 4KB
file
contents.xcplayground 165B
folder
MergeSortedArrays.playground 文件夹
file
Contents.swift 2KB
file
contents.xcplayground 165B
file
README.md 1KB
folder
Graph.playground 文件夹
file
Contents.swift 4KB
file
contents.xcplayground 165B
folder
Bluetooth.playground 文件夹
file
Contents.swift 3KB
file
contents.xcplayground 165B
folder
CheckSumOfItemsInArray.playground 文件夹
file
Contents.swift 2KB
file
contents.xcplayground 165B
folder
InsertionSort.playground 文件夹
file
Contents.swift 558B
file
contents.xcplayground 165B
folder
SelectionSort.playground 文件夹
file
Contents.swift 544B
file
contents.xcplayground 165B
folder
Tree.playground 文件夹
file
Contents.swift 2KB
file
contents.xcplayground 165B
file
.gitignore 2KB
folder
QuickSort.playground 文件夹
file
Contents.swift 1KB
file
contents.xcplayground 165B
folder
CheckCommonItemsInArray.playground 文件夹
file
Contents.swift 2KB
file
contents.xcplayground 165B
folder
BinarySearchTree 文件夹
folder
CheckIfBinarySearchTree.playground 文件夹
file
Contents.swift 2KB
file
contents.xcplayground 165B
folder
IterativeSolution.playground 文件夹
folder
Sources 文件夹
file
BinarySearchTree.swift 769B
file
Contents.swift 5KB
file
contents.xcplayground 165B
folder
RecursiveSolution.playground 文件夹
file
Contents.swift 3KB
file
contents.xcplayground 165B
folder
BigO.playground 文件夹
file
Contents.swift 1KB
file
contents.xcplayground 165B
folder
MergeSort.playground 文件夹
file
Contents.swift 1KB
file
contents.xcplayground 165B
folder
BinarySearchAlgo.playground 文件夹
file
Contents.swift 1KB
file
contents.xcplayground 165B
folder
Static.playground 文件夹
file
Contents.swift 2KB
file
contents.xcplayground 165B
folder
Recursion.playground 文件夹
file
Contents.swift 585B
file
contents.xcplayground 165B
folder
SOLID.playground 文件夹
file
Contents.swift 5KB
file
contents.xcplayground 165B
...
zip 文件大小:53.34KB