Create a subdirectory of your home directory named nov09 not
Solution
Here is the code for you:
int length(node *head)
{
int count = 0;
while(head != NULL)
{
head = head->next;
count++;
}
return count;
}
node *remove_last(node *head)
{
if(head == NULL)
return NULL;
if(head->next == NULL)
return NULL;
node *temp = head;
while(head->next->next != NULL)
head = head->next;
head->next = NULL;
return head;
}
int in_order(node *head)
{
if(head == NULL)
return 1;
while(head->next != NULL)
if(head->info > head->next->info)
return 0;
return 1;
}
node *remove_odd(node *head)
{
if(head == NULL)
return NULL;
if(head->next == NULL)
{
if(head->info % 2 == 1)
return NULL;
else
return head;
}
while(head->next->next != NULL)
{
if(head->info % 2 == 1)
head->next->next;
head = head->next;
}
if(head->next->info % 2 == 1)
head->next = NULL;
return head;
}

