Code Monkey home page Code Monkey logo

algorithms's Introduction

Algorithms and Data Structures

Code Style MIT

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 O(n^2) O(n^2)
Merge Sort ฮ˜(nlogn) ฮ˜(nlogn)
QuickSort O(nlogn) O(n^2)
Counting Sort O(n+k) O(n+k)
Binary Search O(logn) O(logn)
Bubble Sort O(n^2) O(n^2)
Heapsort O(nlogn) O(nlogn)
Breadth-first Search (BFS) O(|V|+|E|) O(|V|+|E|)
Depth-first Search (DFS) O(|V|+|E|) O(|V|+|E|)
Prim (MST) O(|E|log|V|) O(|E|log|V|)
Kruskal (MST) O(|E|log|V|) O(|E|log|V|)
Bellman-Ford O(|E||V|) O(|E||V|)
Dijkstra O(|E|+|V|log|V|) O(|E|+|V|log|V|)
Maximum subarray (J.Kadane) O(n) O(n)

Data Structures Implemented

Data Structure Methods
Linked list insertFront(int value) - O(1), deleteFront() - O(1), isEmpty() - O(1)
Double Linked list insertFront(int value) - O(1), deleteFront() - O(1)
Queue enqueue(int value) - O(1), dequeue() - O(1), isEmpty() - O(1)
Stack pop() - O(1), push() - O(1), top() - O(1), isEmpty() - O(1)
Binary Search Tree (BST) insert(int value) - ฮ˜(logn), search(int value) - ฮ˜(logn), printInOrder() - ฮ˜(n), printPreOrder() - ฮ˜(n), printPostOrder() - ฮ˜(n)
Heap (binary max heap) heapify(int index) - O(logn), insert(int value) - O(logn), deleteMax() - O(logn), buildHeap(vector<int> values) - O(n), heapSort() - O(nlogn)
Heap (binary min heap) heapify(int index) - O(logn), insert(int value) - O(logn), deleteMin() - O(logn), buildHeap(vector<int> values) - O(n), heapSort() - O(nlogn)
Disjoint Set makeSet() - ฮ˜(1), findSet() - ฮ˜(1), union() - ฮ˜(1)
Trie add() - O(|string|), find() - O(|string|)

License

Licensed under MIT.

algorithms's People

Contributors

alexprut avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

pgoreutn

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.