subject

#include #include

typedef struct nod{
int info;
struct nod *next;
}node;

node* SortInsert(node *root, int item); //this function is complete
void simplePrint(node* root); //this function is complete
int countNodes (node* root); //to create this function
node* EvenCopy(node * root); //to create this function

int main()
{
node* head=NULL;
node* head2 = NULL;

node *t;
int ch, ele;
head = SortInsert(head, 4);
head = SortInsert(head,6);
head = SortInsert(head,3);
head = SortInsert(head,5);

printf("\nSimple print List 1: ");
simplePrint(head);

printf("\nCount Nodes %d", countNodes(head)); //modify the countNodes function to make it work

head2 = EvenCopy(head); //modify the EvenCopy function to make it work
printf("\nSimple print after EvenCopy: ");
simplePrint(head2); //This call should print 4, 6

return 0;

}

void simplePrint(node* root)
{
node* t=root;
while(t!=NULL)
{
printf("%d ",t->info);
t=t->next;
}
}

node* SortInsert(node* root, int item)
{
node *temp;
node *t;
temp= (node *) malloc(sizeof(node));
temp->info=item;
temp->next=NULL;
if (root==NULL || root->info >=item)
{
temp->next = root;
root = temp;
}
else
{
t = root;
while (t->next != NULL && t->next->info next;
temp->next = t->next;
t->next = temp;
}

return root;
}

THE FOLLOWING QUESTIONS ARE HERE:

int countNodes (node* root)
{
/*this function takes the head of a linked list and returns the number of nodes available in the linked list. You can use for loops or recursion */

}

node* EvenCopy(node * root)
{
/*this function takes the head of a linked list and copies all the even numbers to a new linked list and return the
head of the new linked list. Note that a number is considered as even if number%2 is 0.
Example: passing the head of a linked list containing 3, 4, 5, 6 would return another linked list containing 4, 6 */

}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 15:00
This is not a factor that you should use to determine the content of your presentation. your audience your goals your purpose your technology
Answers: 1
question
Computers and Technology, 23.06.2019 01:00
Write the command that can be used to answer the following questions. (hint: try each out on the system to check your results.) a. find all files on the system that have the word test" as part of their filename. b. search the path variable for the pathname to the awk command. c. find all files in the /usr directory and subdirectories that are larger than 50 kilobytes in size. d. find all files in the /usr directory and subdirectories that are less than 70 kilobytes in size. e. find all files in the / directory and subdirectories that are symbolic links. f. find all files in the /var directory and subdirectories that were accessed less than 60 minutes ago. g. find all files in the /var directory and subdirectories that were accessed less than six days ago. h. find all files in the /home directory and subdirectories that are empty. i. find all files in the /etc directory and subdirectories that are owned by the group bin."
Answers: 1
question
Computers and Technology, 23.06.2019 17:00
What does the faves button do? a. users mark a web page as a favorite b. leads other readers to favor a specific page c. readers sort and align their favicons, or favorite icons d. leads users to a message board where they can post questions
Answers: 1
question
Computers and Technology, 24.06.2019 01:30
Hazel has just finished adding pictures to her holiday newsletter. she decides to crop an image. what is cropping an image?
Answers: 1
You know the right answer?
#include #include

typedef struct nod{
int info;
struct nod *next;
}n...
Questions
question
Health, 13.04.2020 16:18
question
Chemistry, 13.04.2020 16:18
question
Mathematics, 13.04.2020 16:18