Skip to content

JMatharu/AlgoBrain

Repository files navigation

AlgoBrain

Swift Build Status codecov BSD 3-Clause LiCENSE

A very simple Swift Package with implemented Data Structure and Algorithms for direct use into project.

To understand recursion one should understand recursion.

Don't forget to star the repo 😊.

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 AlgoBrain and select the version to install

Usage

import AlgoBrain

Using 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 -> 4

Similarly 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

About

A very simple Swift Package with implemented Data Structure and Algorithms for direct use to project.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages