38# include <gtest/gtest.h>
43using namespace testing;
51 for (
size_t i = 0; i < 25; ++i)
157 EXPECT_EQ(list.get_first(), list.get_head());
158 EXPECT_EQ(list.get_last(), list.get_tail());
186 EXPECT_EQ(it.get_curr()->to_snodenc<
int>()->get_data(), i);
206 EXPECT_EQ(it.get_curr()->to_data<
int>(), i);
209 EXPECT_EQ(it.get_curr()->to_data<
int>(), i);
215 EXPECT_EQ(it.get_curr()->to_data<
int>(), i);
229 EXPECT_EQ(it.get_curr()->to_data<
int>(), i);
231 laux.remove_all_and_delete();
237 for (
size_t i = 1; i < 13; ++i, it.
next())
263 EXPECT_EQ(it.get_curr()->to_data<
int>(), i);
269 EXPECT_EQ(it.get_curr()->to_data<
int>(), i);
286 EXPECT_EQ(it.get_curr()->to_data<
int>(), i);
295 for (
int i = 0, n = 4; i < 3; ++i, ++n, it.
next())
299 list.rotate_left(22);
302 EXPECT_EQ(it.get_curr()->to_data<
int>(), i);
T & insert(const T &item)
T & get_last() const
Return the last item of the list.
T & get_first() const
Return the first item of the list.
DynList & reverse() noexcept
void reset_first() noexcept
bool is_in_last() const noexcept
Return true if the iterator is positioned on the last item.
bool is_last() const noexcept
Slinknc * get_curr() const
bool has_curr() const noexcept
bool is_in_first() const noexcept
Return true if the iterator is positioned on the first item.
Single linked list of nodes.
Slinknc * get_first() const noexcept
void push(Slinknc *link) noexcept
void remove_all_and_delete() noexcept
Slinknc * get_tail() const noexcept
constexpr bool is_empty() const noexcept
Slinknc * get_head() const noexcept
void rotate_left(size_t n)
Rotate to left the list n positions.
void cut(Slinknc *link, HTList &list) noexcept
It cuts 'this' over 'link' element and it puts all.
HTList & swap(HTList &l) noexcept
void append(Slinknc *link) noexcept
size_t split(HTList &l, HTList &r) noexcept
size_t size() const noexcept
Count the number of elements of the list.
void insert(Slinknc *link) noexcept
bool is_unitarian() const noexcept
Return true if the list contains exactly just one.
Slinknc * get_last() const noexcept
Return the last item of the list (nullptr if the list is empty)
bool is_unitarian_or_empty() const noexcept
Return true if list contains one element or is empty.
Link of a single linked list non-circular and without header node.
Snodenc< T > * to_snodenc() noexcept
Convert this to a Snodenc<T>.
T & get_data() noexcept
Return a modifiable reference to the data.
Singly linked list implementations with head-tail access.
TEST_F(List_of_25_nodes, Basic_operations)
Main namespace for Aleph-w library functions.
void reverse(Itor beg, Itor end)
Reverse elements in a range.
T & swap(T &t1, T &t2)
Generic swap using object's swap method.
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.
void rotate_left(T *ptr, const size_t n, size_t m) noexcept
Rotate array elements left by m positions.