41# define RAND( x ) (unsigned long) ( x * ( rand() / (RAND_MAX+1.0) ) )
58 unsigned long seed,index;
59 unsigned long i, value, val;
79 seed = std::time(
nullptr);
88 cout << t[10]->a1 << t[10000]->a1 <<
endl;
102 v2[index] = v1[index];
105 cout <<
"(" << val <<
") (" << value <<
") ";
106 assert(v2[index] == v1[index]);
128 catch(
const std::overflow_error&)
130 cout <<
"Overflow!" <<
endl;
132 catch(
const std::bad_alloc&)
134 cout <<
"Not enough memory!" <<
endl;
136 catch(
const std::invalid_argument&)
138 cout <<
"invalid_argument!" <<
endl;
140 catch (
const std::exception & e)
142 cout << e.what() <<
endl;
151 cout << s.
access(0) <<
" ****************" <<
endl;
153 cout << s.
access(0) <<
" ****************" <<
endl;
157 cout << s[1] <<
" ****************" <<
endl;
166 cout << s[0] <<
" ****************" <<
endl;
168 cout << s.
access(0) <<
" ****************" <<
endl;
172 cout << s[1] <<
" ****************" <<
endl;
177 for (
size_t i = 0; i <
NUM_ITE; ++i)
181 cout << it.get_curr() <<
" ";
Iterator on the items of array.
void reset_last() noexcept
Reset the iterator to the last item.
void prev()
Move the current a position backward.
bool has_curr() const noexcept
Return true if there is current item.
T & get_curr() const
Return the current item.
Set-like container backed by a dynamic array.
T & touch(const size_t i)
Touch the entry i.
T & access(const size_t i) const noexcept
Fast access without checking allocation and bound_min_clock checking.
T & append()
Allocate a new entry to the end of array.
void reserve(const size_t l, const size_t r)
Allocate a range of entries.
Main namespace for Aleph-w library functions.
Divide_Conquer_DP_Result< Cost > divide_and_conquer_partition_dp(const size_t groups, const size_t n, Transition_Cost_Fn transition_cost, const Cost inf=dp_optimization_detail::default_inf< Cost >())
Optimize partition DP using divide-and-conquer optimization.