Write C++ code to:
A linked list version of any_different(), called like
this:
bool any_different() const
(3) A RECURSIVE list member function of integer_linked_list
that returns true if all elements in the list are equal to a passed
in value.
bool all_equal_to(int val) const. // calls helper
bool all_equal_to_helper(snode* no, int val) const. //
recursive
e.g., if the list had
10-->20-->30-->40-->50-->nullptr
and was passed val=30, it would return false
but if the list had
20-->20-->20-->20-->20-->10,
and was passed val=40, it would return false,
bur if it was passed val=20, it would return true
A RECURSIVE list member function of integer_linked_list that
returns true if all elements in the list are equal to a passed in
value.
Here ,head is the first node of integer_linked_list
bool all_equal_to(int val) const{
return all_equal_to_helper(head,val);
}
bool all_equal_to_helper(snode* no, int val) const{
if(no == NULL)return true;
if(no->data != val)return false;
return all_equal_to_helper(no->next,val);
}
Write C++ code to: A linked list version of any_different(), called like this: bool any_different() const...