33# include <gsl/gsl_rng.h>
49template <
template <
class>
class C,
typename T>
52 for (
typename C<T>::Iterator it(c); it.has_curr(); it.next())
53 cout << it.get_curr() <<
" ";
70 cout <<
"** indexes(l1) = ";
73 cout <<
"(" << t.first <<
"," << t.second <<
")";
80 auto to_str = [&
l1] (
int i) -> std::string
82 return std::to_string(i);
94 for (
DynList<std::pair<int,int>>::Iterator it(
lz1); it.has_curr(); it.next())
95 cout << it.get_curr().first <<
"," << it.get_curr().second <<
endl;
98 cout <<
"Building random list" <<
endl;
100 for (
long i = 0; i < n; ++i)
104 <<
"building array copy of previous list" <<
endl;
113 <<
"Copying array to a tree" <<
endl;
121 <<
"Sorting array for ulterior fast searching";
125 <<
"traversing all the keys of tree and verifiying them with array"
129 return a(binary_search(a, i)) == i;
131 cout <<
"done!" <<
endl
133 <<
"Traversing all the keys of array and verifiying then with the tree"
137 return tree.search(i) != NULL;
139 cout <<
"done!" <<
endl
Functional programming utilities for Aleph-w containers.
High-level sorting functions for Aleph containers.
T & append()
Allocate a new entry to the end of array.
Dynamic doubly linked list with O(1) size and bidirectional access.
Doubly-linked list (defined in tpl_dynList.H).
T & append(const T &item)
Dynamic set backed by balanced binary search trees with automatic memory management.
Key * append(const Key &key)
Aleph::DynList< T > take(const size_t n) const
Return a list with the first n elements seen in the container during its traversal.
void for_each(Operation &operation)
Traverse all the container and performs an operation on each element.
bool all(Operation &operation) const
Check if all the elements of the container satisfy a condition.
Aleph::DynList< T > drop(const size_t n) const
Drop the first n elements seen in the container during its traversal.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
Singly linked list implementations with head-tail access.
DynList< std::pair< typename Container1::Item_Type, typename Container2::Item_Type > > zip(const Container1 &a, const Container2 &b)
Zip two containers into a list of pairs.
std::decay_t< typename HeadC::Item_Type > T
std::pair< First, Second > pair
Alias to std::pair kept for backwards compatibility.
DynList< std::pair< size_t, typename Container::Key_Type > > indexes(const Container &c)
Return pairs of (index, key).
std::string to_str(const double d)
Convert double to a std::string with maximum round-trip precision.
Container< T > range(const T start, const T end, const T step=1)
Generate a range of values [start, end] with a given step.
void quicksort_op(C< T > &a, const Compare &cmp=Compare(), const size_t threshold=Quicksort_Threshold)
Optimized quicksort for containers using operator().
Aleph::DynList< T > keys() const
void print_seq(const C< T > &c)
Dynamic doubly linked list implementation.
Dynamic set implementations based on balanced binary search trees.
Unified hash table interface.