PGryllos / FnStd

fast advanced non-standard data structures

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fast not Standard Data Structures (FnStd)

This is a collection of Data Structures which you will not find in STL. That's what "not Standard" stands for.

You can use this code in your own responsibility because it comes with no Warranty!
You can use and redistribute without any constraints as the LICENSE suggests.

####requirements If you want to use this repository you need to have C++11 or above. You also need BOOST Library.


content ---

[MedianList]
Calculates the streaming median of a set of integers. For doing that it uses two Fibonacci Heaps and a hashtable.

Inserting to MedianList cost
1 lookup to boost Unordered Map (O(C1) C1 is the number of collisions for a specific key)
1 push_back operation to an std vector (O(C2))
1 push to a Fibonacci Heap (O(C3))
O(C1) + O(C2) + O(C3)

Deletion from MedianList cost
1 lookup to boost Unordered Map (O(C1))
1 deletion from Boost Fibonacci Heap (O(logN) N is the number of elements in the MedianLists)
1 pop_back operation from std vector (O(C2))
O(C1) + O(logN) + O(C2)

[CircFifo]
Circular Queue implemented only with static array.

[TopX]
Keeps ten highest values in static array. All other values are stored in a Fibonacci Heap.

TODO LIST

  • Make MedianList and TopX type independent (templates)
  • Implement remove method for TopX
  • Benchmark medianList (use std list for the same purpose and compare)

credits to stackoverflow user from whom I saw the two heap solution for the running median problem here.

About

fast advanced non-standard data structures

License:MIT License


Languages

Language:C++ 100.0%