256using namespace Aleph;
294# define N (stack.top().n)
295# define F1 (stack.top().f1)
296# define RESULT (stack.top().result)
297# define RETURN_POINT (stack.top().return_point)
347 if (stack.
size() == 1)
359 switch (return_point)
374 try { n = std::stoi(
argv[1]); }
375 catch (
const std::exception& e)
377 std::cerr <<
"Warning: could not parse n, using default n=10" << std::endl;
384 std::cerr <<
"n must be non-negative" << std::endl;
388 cout <<
"fib(" << n <<
") = " <<
fib_rec(n) <<
" = " <<
fib_it(n)
Stack implemented with simple dynamic array and with bounds verification.
size_t size() const noexcept
Return the number of elements stored in the stack.
T pop()
Extract the last more recently inserted element.
T & push(const T &data)
Push into stack a copy of data
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.
Stack implementations backed by dynamic or fixed arrays.