Implement new C++ data structure to power algorithms

Fixes #216.
Obsoletes https://github.com/numenta/nupic.core/pull/217.
No, this function sorts it before using it.