AlgoBrain

Swift Build Status codecov BSD 3-Clause LiCENSE

一个非常简单的 Swift 包,实现了数据结构和算法,可直接用于项目中。

要理解递归,首先要理解递归。

不要忘记给仓库点个星星 😊。

已完成

数据结构

算法

搜索

排序

安装

用法

import AlgoBrain

使用链表

var linkedList = LinkedList<Int>()
linkedList.insertAt(.end, with: 0)
linkedList.insertAt(.start, with: 1)
linkedList.insertAt(.start, with: 2)
linkedList.insertAt(.start, with: 3)
linkedList.insertAt(.index(2), with: 4)
print(linkedList.head) // 3 -> 2 -> 4 -> 1 -> 0
linkedList.removeAt(.start)
linkedList.removeAt(.end)
linkedList.removeAt(.index(2))
print(linkedList.head) // 2 -> 4

类似地,可以使用其他数据结构和算法。

注意:库中的所有方法都标明了其时间复杂度。

进行中

数据结构

算法

排序