Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In this file you will write two functions called sum and count. Both functions w

ID: 3758699 • Letter: I

Question

In this file you will write two functions called sum and count. Both functions will take in a pointer to a linked list node. The function sum will return the sum of the integers found in the linked list. The function count will return the number of integers found in the linked list.

For example, if your linked list contains the integers

The sum function would return the value 34 and the count function would return 6.

For this assignment you will need the files below

Here is a run of the driver if you implement your function correctly

If one of your functions does not work then you will see output similar to

In C not C++ please!!!!!!

Explanation / Answer

int sum(Node *root){
   int sum = 0;
   while(root != NULL)
       sum += root->key;
   return sum;
}

int count(Node *root){
   int count = 0;
   while(root != NULL)
       count++;
   return sum;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote