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, 21.06.2019 21:00
Is it ok to use a does red wine clean the inside of a computer true or false
Answers: 2
question
Computers and Technology, 21.06.2019 22:40
Write an assembly program with the following specifications.a). in the main block, you should have two registers r4 and r5. they should be checked in an infinite loop. if r4 is greater than r5, then the greater subroutine will be called. if r4 is less than r5, then the less subroutine will be called. if r4 equals r5, then no operations will be done
Answers: 1
question
Computers and Technology, 22.06.2019 00:00
Match each vocabulary word to its definition.1. desktoppicture used to represent acomputer application2. domainnetwork protectionsoftware code that can be viewed,3. iconmodified, and redistributed for freethe background screen on acomputer monitor4. url5. blogan online journalthe part of an internet address that6. firewallrefers to a group of computers on anetworkonline database of web pages7. intranetnetwork for use by an individual8. open address of a web page or9. wikiresource
Answers: 2
question
Computers and Technology, 23.06.2019 15:00
Idon’t understand the double8 coding problem. it is java
Answers: 1
You know the right answer?
#include #include

typedef struct nod{
int info;
struct nod *next;
}n...
Questions
question
Social Studies, 11.09.2020 23:01
question
Mathematics, 11.09.2020 23:01
question
Mathematics, 11.09.2020 23:01
question
Mathematics, 11.09.2020 23:01
question
Chemistry, 11.09.2020 23:01
question
History, 11.09.2020 23:01
question
Mathematics, 11.09.2020 23:01
question
Mathematics, 11.09.2020 23:01
question
Mathematics, 11.09.2020 23:01
question
Mathematics, 11.09.2020 23:01
question
English, 11.09.2020 23:01
question
English, 11.09.2020 23:01
question
Mathematics, 11.09.2020 23:01
question
Arts, 11.09.2020 23:01
question
Mathematics, 11.09.2020 23:01
question
French, 11.09.2020 23:01
question
Mathematics, 11.09.2020 23:01
question
Mathematics, 11.09.2020 23:01
question
Mathematics, 11.09.2020 23:01
question
English, 11.09.2020 23:01
Questions on the website: 13722361