Answer to Question #265777 in C++ for Roe

Question #265777

Write recursive procedures for the following problems :


1)Factorial


2)Print linked list


3)Print reverse linked list

1
Expert's answer
2021-11-14T10:43:04-0500
int fact(int n) {
  if (n == 0) return 1;
  else return n * fact(n-1);
}


void PrintList(Node* curr)
{
    if (curr==NULL)
    {
        cout << "\n";
        return;
    }
    cout << curr->data <<endl;
    PrintList(curr->next);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS