Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexprut/algorithms
🍒 Classic Algorithms and Data Structures implemented in C++
https://github.com/alexprut/algorithms
algorithms computer-science cplusplus
Last synced: about 1 month ago
JSON representation
🍒 Classic Algorithms and Data Structures implemented in C++
- Host: GitHub
- URL: https://github.com/alexprut/algorithms
- Owner: alexprut
- License: mit
- Created: 2015-07-15T16:37:42.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-07-14T18:33:25.000Z (over 5 years ago)
- Last Synced: 2024-12-06T19:16:28.994Z (3 months ago)
- Topics: algorithms, computer-science, cplusplus
- Language: C++
- Homepage:
- Size: 48.8 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![]()
Algorithms and Data Structures
[](https://google.github.io/styleguide/cppguide.html)
[](https://github.com/alexprut/design-patterns-java/blob/master/LICENSE)Classic Algorithms and Data Structures implemented in C++
_Code written for practice. During my Master's degree in Computer Science at the University of Udine._
Algorithms Implemented
======================|Algorithm|Average Cost|Worst-case Cost|
|---|---|---|
|[Insertion Sort](https://github.com/alexprut/Algorithms/blob/master/insertionSort.cpp)|O(n^2)|O(n^2)|
|[Merge Sort](https://github.com/alexprut/Algorithms/blob/master/mergeSort.cpp)|Θ(nlogn)|Θ(nlogn)|
|[QuickSort](https://github.com/alexprut/Algorithms/blob/master/quickSort.cpp)|O(nlogn)|O(n^2)|
|[Counting Sort](https://github.com/alexprut/Algorithms/blob/master/quickSort.cpp)|O(n+k)|O(n+k)|
|[Binary Search](https://github.com/alexprut/Algorithms/blob/master/binarySearch.cpp)|O(logn)|O(logn)|
|[Bubble Sort](https://github.com/alexprut/Algorithms/blob/master/bubbleSort.cpp)|O(n^2)|O(n^2)|
|[Heapsort](https://github.com/alexprut/Algorithms/blob/master/binaryMaxHeap.cpp#L133)|O(nlogn)|O(nlogn)|
|[Breadth-first Search (BFS)](https://github.com/alexprut/Algorithms/blob/master/breadthFirstSearch.cpp)|O(\|V\|+\|E\|)|O(\|V\|+\|E\|)|
|[Depth-first Search (DFS)](https://github.com/alexprut/Algorithms/blob/master/breadthFirstSearch.cpp)|O(\|V\|+\|E\|)|O(\|V\|+\|E\|)|
|[Prim (MST)](https://github.com/alexprut/Algorithms/blob/master/breadthFirstSearch.cpp)|O(\|E\|log\|V\|)|O(\|E\|log\|V\|)|
|[Kruskal (MST)](https://github.com/alexprut/Algorithms/blob/master/kruskal.cpp)|O(\|E\|log\|V\|)|O(\|E\|log\|V\|)|
|[Bellman-Ford](https://github.com/alexprut/Algorithms/blob/master/bellmanFord.cpp)|O(\|E\|\|V\|)|O(\|E\|\|V\|)|
|[Dijkstra](https://github.com/alexprut/Algorithms/blob/master/dijkstra.cpp)|O(\|E\|+\|V\|log\|V\|)|O(\|E\|+\|V\|log\|V\|)|
|[Maximum subarray (J.Kadane)](https://github.com/alexprut/Algorithms/blob/master/maxSubArray.cpp)|O(n)|O(n)|Data Structures Implemented
===========================
|Data Structure|Methods|
|--------------|-------|
|[Linked list](https://github.com/alexprut/Algorithms/blob/master/linkedList.cpp)|```insertFront(int value)``` - O(1), ```deleteFront()``` - O(1), ```isEmpty()``` - O(1)|
|[Double Linked list](https://github.com/alexprut/Algorithms/blob/master/doubleLinkedList.cpp)|```insertFront(int value)``` - O(1), ```deleteFront()``` - O(1)|
|[Queue](https://github.com/alexprut/Algorithms/blob/master/queue.cpp)|```enqueue(int value)``` - O(1), ```dequeue()``` - O(1), ```isEmpty()``` - O(1)|
|[Stack](https://github.com/alexprut/Algorithms/blob/master/stack.cpp)|```pop()``` - O(1), ```push()``` - O(1), ```top()``` - O(1), ```isEmpty()``` - O(1)|
|[Binary Search Tree (BST)](https://github.com/alexprut/Algorithms/blob/master/binarySearchTree.cpp)|```insert(int value)``` - Θ(logn), ```search(int value)``` - Θ(logn), ```printInOrder()``` - Θ(n), ```printPreOrder()``` - Θ(n), ```printPostOrder()``` - Θ(n)|
|[Heap (binary max heap)](https://github.com/alexprut/Algorithms/blob/master/binaryMaxHeap.cpp)|```heapify(int index)``` - O(logn), ```insert(int value)``` - O(logn), ```deleteMax()``` - O(logn), ```buildHeap(vector values)``` - O(n), ```heapSort()``` - O(nlogn)|
|[Heap (binary min heap)](https://github.com/alexprut/Algorithms/blob/master/binaryMaxHeap.cpp)|```heapify(int index)``` - O(logn), ```insert(int value)``` - O(logn), ```deleteMin()``` - O(logn), ```buildHeap(vector values)``` - O(n), ```heapSort()``` - O(nlogn)|
|[Disjoint Set](https://github.com/alexprut/Algorithms/blob/master/disjointSet.cpp)|```makeSet()``` - Θ(1), ```findSet()``` - Θ(1), ```union()``` - Θ(1)|
|[Trie](https://github.com/alexprut/Algorithms/blob/master/trie.cpp)|```add()``` - O(\|string\|), ```find()``` - O(\|string\|)|License
=======
Licensed under [MIT](https://github.com/alexprut/Algorithms/blob/master/LICENSE).