Skip to content

iHhx/Algorithms

Repository files navigation

The Algorithms in C++

Codacy Badge

These algorithms are the demonstration purposes only. There are many algorithms implementations in the C++ standard library that are much better for performance reasons. This project contains the following algorithms...

Allocators

Name allocator Allocation Free
Linear allocator O(1) -
Standard allocator O(1) -

Cryptography

Name algorithm
Caesar cipher
Hex
Crypto random + entropy
RC4 cipher

Data structures

Name structure Indexation Search Inserting Deleting Memory
Circular buffer O(n) O(n) O(1) O(1) O(n)
Linked list O(n) O(n) O(1) O(1) O(n)
XOR Linked list O(n) O(n) O(1) O(1) O(n)

Search

Name algorithm Data Structure Average result Worse result
Binary search Sorted array O(log(n)) O(log(n))
Linear search Array O(n) O(n)

Set operations

Name algorithm
Difference between ordered sets
Generation of all permutations from set
Generation of all subsets of the set
Intersection of the ordered sets
Symmetric difference of ordered sets
Union of the ordered sets
Union of the ordered sets w doubles

Smart pointers

Name pointer
Shared smart pointer
Unique smart pointer

Sorting

Name algorithm Data Structure Best result Average result Worse result
Bubble sorting Array O(n) O(n^2) O(n^2)
Bucket sorting Array O(n) O(n) O(n^2)
Counting sorting Array O(n) O(n) O(n)
Insertion sorting Array O(n^2) O(n^2) O(n^2)
Merge sorting Array O(n*log(n)) O(n*log(n)) O(n*log(n))
Move elements to left Array O(n) O(n) O(n)
Quick sorting Array O(n*log(n)) O(n*log(n)) O(n^2)
Selection sorting Array O(n) O(n^2) O(n^2)
Shell sorting Array O(n^2) O(n^2) O(n^2)
Stupid sorting Array O(n) O(n^3) O(n^3)

Others

Name algorithm
Fibonacci
Reversal forward list
Reverse matrix diagonals
Rotate matrix

Templates

Name templates
Copy string
Number to string 32 bits

About

Different algorithms implemented in C++

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •