diff --git a/alib2algo_experimental/src/graph/datastructs/BinomialHeap.h b/alib2algo_experimental/src/graph/datastructs/BinomialHeap.h index 0185cdc10b3adeef162acc1b76abb704174f9674..feeb9e66c39b0b17dc5aec1736798378ab5580d3 100644 --- a/alib2algo_experimental/src/graph/datastructs/BinomialHeap.h +++ b/alib2algo_experimental/src/graph/datastructs/BinomialHeap.h @@ -8,8 +8,6 @@ #ifndef BINOMIAL_HEAP_INCLUDED #define BINOMIAL_HEAP_INCLUDED -#include <sys/types.h> - #include <stdexcept> /// binomial heap used as mergeable priority queue @@ -30,22 +28,22 @@ class BinomialHeap { /// merges this heap with another heap (!! this is a DESTRUCTIVE merge, heap in argument will be cleared !!) void mergeWith( BinomialHeap<elem_t> && that ); - uint size() const { return _size; } + size_t size() const { return _size; } protected: struct Node { elem_t value; - uint degree; + unsigned degree; Node * parent; Node * child; Node * sibling; - Node( const elem_t & val, uint deg = 0, Node * par = NULL, Node * chld = NULL, Node * sib = NULL ) + Node( const elem_t & val, unsigned deg = 0, Node * par = NULL, Node * chld = NULL, Node * sib = NULL ) : value(val), degree(deg), parent(par), child(chld), sibling(sib) {} }; Node * _head; ///< head of a singly linked list of binomial trees - uint _size; ///< count of elements stored in the heap + size_t _size; ///< count of elements stored in the heap int (* _compare)( const elem_t &, const elem_t & ); ///< user-defined comparator function protected: diff --git a/alib2algo_experimental/src/graph/datastructs/Components.h b/alib2algo_experimental/src/graph/datastructs/Components.h index 74737e278f14975e5405d9107c1e14930db60350..3db1f0080b2da3bb6d29e22fb623b8f4effbe44e 100644 --- a/alib2algo_experimental/src/graph/datastructs/Components.h +++ b/alib2algo_experimental/src/graph/datastructs/Components.h @@ -1,12 +1,10 @@ /* - * Kruskal.cpp + * Composnents.h * * Created on: Mar 26, 2016 * Author: Jan Broz */ -#include <sys/types.h> - #include <unordered_map> #include <graph/common/Node.h> @@ -73,7 +71,7 @@ class Components2 { /// wrapper over the node containing identification of parent and height of subtree struct SetNode { - uint parent; + unsigned parent; int height; }; @@ -81,18 +79,18 @@ class Components2 { public: - Components2( uint nodeCount ) { _nodes = new SetNode [nodeCount]; } + Components2( unsigned nodeCount ) { _nodes = new SetNode [nodeCount]; } ~Components2() { delete [] _nodes; } /// marks a node as a single-element component - void MakeSet( uint node ) + void MakeSet( unsigned node ) { _nodes[ node ].parent = node; _nodes[ node ].height = 0; } /// returns a reprezentative of the component in which the given node is - uint Find( uint node ) + unsigned Find( unsigned node ) { if (node != _nodes[ node ].parent) _nodes[ node ].parent = Find( _nodes[ node ].parent ); // shorten the path to root for next use @@ -100,14 +98,14 @@ class Components2 { } /// unifies 2 acyclic components - void Union( uint node1, uint node2 ) + void Union( unsigned node1, unsigned node2 ) { Link( Find( node1 ), Find( node2 ) ); } protected: - void Link( uint root1, uint root2 ) + void Link( unsigned root1, unsigned root2 ) { // connect smaller into bigger to limit the final depth if (_nodes[ root1 ].height < _nodes[ root2 ].height) {