Skip to main content
Notice removed Insufficient justification by Jamal
deleted 1 character in body
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

I figured it out using a recursive function. whatWhat it does is it loops through the linked list until the end, creating a recursion tree, then executes the print in reverse, when going down the recursion tree.

    void ReversePrint(Node *head)
{
    if (head == NULL) {
        return;
    }
    // recursion tree. loops through until end of linked list
    ReversePrint(head->next);
    // once the recursive is done, then prints head->data going back down the recursion tree.
    printf("%d\n", head->data);
}

figured it out using recursive function. what it does is it loops through the linked list until the end creating a recursion tree, then executes the print in reverse, when going down the recursion tree.

    void ReversePrint(Node *head)
{
    if (head == NULL) {
        return;
    }
    // recursion tree. loops through until end of linked list
    ReversePrint(head->next);
    // once the recursive is done, then prints head->data going back down the recursion tree.
    printf("%d\n", head->data);
}

I figured it out using a recursive function. What it does is it loops through the linked list until the end, creating a recursion tree, then executes the print in reverse, when going down the recursion tree.

    void ReversePrint(Node *head)
{
    if (head == NULL) {
        return;
    }
    // recursion tree. loops through until end of linked list
    ReversePrint(head->next);
    // once the recursive is done, then prints head->data going back down the recursion tree.
    printf("%d\n", head->data);
}
added 365 characters in body
Source Link
Clefairy
  • 433
  • 1
  • 7
  • 15

figured it out: using recursive function. what it does is it loops through the linked list until the end creating a recursion tree, then executes the print in reverse, when going down the recursion tree.

    void ReversePrint(Node *head)
{
    if (head == NULL) {
        return;
    }
    // recursion tree. loops through until end of linked list
    ReversePrint(head->next);
    // once the recursive is done, then prints head->data going back down the recursion tree.
    printf("%d\n", head->data);
}

figured it out:

void ReversePrint(Node *head)
{
  if (head == NULL) {
      return;
  }
    ReversePrint(head->next);
    printf("%d\n", head->data);
}

figured it out using recursive function. what it does is it loops through the linked list until the end creating a recursion tree, then executes the print in reverse, when going down the recursion tree.

    void ReversePrint(Node *head)
{
    if (head == NULL) {
        return;
    }
    // recursion tree. loops through until end of linked list
    ReversePrint(head->next);
    // once the recursive is done, then prints head->data going back down the recursion tree.
    printf("%d\n", head->data);
}
Notice added Insufficient justification by Jamal
Source Link
Clefairy
  • 433
  • 1
  • 7
  • 15

figured it out:

void ReversePrint(Node *head)
{
  if (head == NULL) {
      return;
  }
    ReversePrint(head->next);
    printf("%d\n", head->data);
}