Skip to content

Latest commit

 

History

History
84 lines (68 loc) · 9.7 KB

README.md

File metadata and controls

84 lines (68 loc) · 9.7 KB

Datastructures And Algorithms

Most popular data structures and algorithms

Build Status Coverage MIT GitHub release Maven

Data Structures

Data Structure Methods
Linked List pushFront() - O(1), popFront() - O(1), pushBack() - O(1), popBack() - O(1), getHead() - O(1), getSize() - O(1), contains() - O(n)
Stack push() - O(1), pop() - O(1), isEmpty() - O(1), getSize() - O(1), peek() - O(1)
Queue enqueue() - O(1), dequeue() - O(1), isEmpty() - O(1), getSize() - O(1) isFull() - O(1)
Deque enqueueFront() - O(1), enqueueRear() - O(1), dequeueFront() - O(1), dequeueRear() - O(1), isEmpty() - O(1), getSize() - O(1) peekFront() - O(1), peekRear - O(1)
Map put() - O(n), remove() - O(n), get() - O(n), getSize() - O(1), containsValue() - O(n), containsKey() - O(n)
MinHeap insert() - O(logn), remove() - O(logn), heapify() - O(logn)
Binary Search Tree insert() - O(n), find() - O(n), delete() - O(n), size() - Θ(1), findMin() - O(n), getTreeHeight() - O(n), preOrderVisit() - O(n), inOrderVisit() - O(n), postOrderVisit() - O(n)
Trie insert() - O(|s|), search() - O(|s|)
Graph

Algorithms

Sorting

Algorithm Worst-case time complexity Average-case time complexity Best-case time complexity
BubbleSort O(n^2) O(n^2) O(n)
InsertionSort O(n^2) O(n^2) O(n)
QuickSort O(n^2) O(nlogn) O(nlogn)
SelectionSort O(n^2) O(n^2) O(n^2)
MergeSort O(nlogn) O(nlogn) O(nlogn)
HeapSort O(nlogn) O(nlogn) O(nlogn)

Strings

Arrays

Stacks

Lists

Trees

Dependency

To add a dependency using Maven:

<dependency>
  <groupId>io.github.mihaijulien</groupId>
  <artifactId>ds-and-algo</artifactId>
  <version>2.0.0</version>
</dependency>

To add a dependency using Gradle:

implementation 'io.github.mihaijulien:ds-and-algo:2.0.0'

Build

mvn clean install

Generate Changelog

git-chglog

License

Licensed under MIT.