Hello,
Can anyone make sure the two functions are correct?
First, this is function should return true if all of the nodes are positive.otherwise, false.
bool AllPositive(Node * h);
{
node* current= head;
while (current !=NULL)
{
if (current < 0)
{
return false;
}
else
{
return true;
}
Second,this function takes takes the heads of the 2 linked lists and returns true if h1 has more nodes than h2.
for this function I think it is something that has to do with the length. so I wrote this but im not sure where to start.
int Length( node* h)
{
node* current = head;
int count = 0;
while (current != NULL)
{
count++;
current = current->next;
}
return count;
}