39 return (
static_cast<Dnode<int>*
>(p)->get_data() <
51 catch (...) { n = 1000; }
57 cerr <<
"Error: n must be a positive integer." <<
endl;
61 unsigned int t = std::time(0);
65 try { t =
static_cast<unsigned int>(
stoul(
argv[2])); }
66 catch (...) { t = std::time(0); }
71 cout <<
argv[0] <<
" " << n <<
" " << t <<
endl;
75 for (
int i = 0; i < n; ++i)
83 cout << it.get_curr()->get_data() <<
" ";
88 cout << n/2 <<
" se encuentra en la lista" <<
endl;
90 cout << n/2 <<
" no se encuentra en la lista" <<
endl;
96 cout << n/2 <<
" se encuentra en la lista" <<
endl;
98 cout << n/2 <<
" no se encuentra en la lista" <<
endl;
103 cout << it.get_curr()->get_data() <<
" ";
110 cout <<
"El elemento " << n/2 <<
" es: " << ptr->
get_data() <<
endl;
bool has_curr() const noexcept
Return true if the iterator has current item.
Doubly linked circular list node.
void remove_all_and_delete() noexcept
Remove and free memory for all the items of list.
void append(Dlink *node) noexcept
Insert node before this.
bool check()
Return true if the list is consistent.
Iterator on a list of Dnode objects.
Node belonging to a double circular linked list with header node.
T & get_data() noexcept
Return a modifiable reference to the data contained in the node.
long random_search(T *a, const T &x, const long l, const long r, const Compare &cmp=Compare())
Random search for an element in an array.
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.
bool operator()(Dlink *p, Dlink *q) const
Comprehensive sorting algorithms and search utilities for Aleph-w.