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 22:00
When determining the classification of data, which one of the following is the most important consideration? a. processing systemb. valuec. storage mediad. accessibility
Answers: 2
question
Computers and Technology, 21.06.2019 22:00
3. (6 pts) internally in the computer, with few exceptions, all numerical computation is done using binary numbers. output, however, often uses ascii, which is formed by appending 011 to the left of a bcd code. thus, an algorithm that directly converts a binary integer to a bcd integer is very useful. here is one such algorithm 1) draw lines to the left of the binary number to bound the expected bcd decades. (each decade is a group of 4 bits.) move the binary number one bit to the left. add 0011 to each bcd decade containing a binary value> 0100 repeat steps 2-3 until the last bit in the binary number has been moved into the least significant decade position. (note that when the last bit has been shifted into bcd decade, step 3 is not repeated.) read the bcd result. 2) 3) 4) 5) a) execute the algorithm for the binary number 1101101 b) execute the algorithm for the binary number 01110101110 4. (4 pts) represent the decimal number 3568 in bcd; excess-3 code; ascil; and hex.
Answers: 1
question
Computers and Technology, 22.06.2019 01:30
What kind of motivation is katrina showing? use the drop-down menu to complete the statement. katrina is using motivation because she is personally interested in learning more.
Answers: 2
question
Computers and Technology, 23.06.2019 19:30
Anul 2017 tocmai s-a încheiat, suntem trişti deoarece era număr prim, însă avem şi o veste bună, anul 2018 este produs de două numere prime, 2 şi 1009. dorel, un adevărat colecţionar de numere prime, şi-a pus întrebarea: “câte numere dintr-un interval [a,b] se pot scrie ca produs de două numere prime? “.
Answers: 1
You know the right answer?
#include #include

typedef struct nod{
int info;
struct nod *next;
}n...
Questions
question
History, 10.11.2020 23:20
question
English, 10.11.2020 23:20
question
Mathematics, 10.11.2020 23:20
question
Health, 10.11.2020 23:20
question
Mathematics, 10.11.2020 23:20
question
Computers and Technology, 10.11.2020 23:20
Questions on the website: 13722367