jmatharu/algobrain
A very simple Swift Package with implemented Data Structure and Algorithms for direct use into project.
Completed
Data Structures
- LinkedList
- Singly Linked List - Doubly Linked List
- Queues
- Queue as Array - Queue as LinkedList
- Stacks
- Stack as Array - Stack as LinkedList
Algorithms
Searching
- Linear Search
- Binary Search
Sort
- Bubble Sort
- Insertion Sort
Installation
- Via Swift Packages
- Search for
AlgoBrainand select the version to install
Usage
import AlgoBrainUsing a Linked list
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 -> 4Similarly other datastructures and algorithms can be used.
Note: All the methods from libray are marked with their Time Complexity.
In Progress
Data Structures
- Tree
- Hashing
- Graph
- .......
Algorithms
Sort
- Insertion Sort
- Selection Sort
- Quick Sort
- Merge Sort
- Heap Sort
- Radix Sort
- Counting Sort
- Shell Sort
Package Metadata
Repository: jmatharu/algobrain
Default branch: master
README: README.md