Huawei Machine Test-Reverse link list output

Source: Internet
Author: User

Title Description:
The input is a one-way list, followed by the output of the value in the linked list. The linked list is defined as follows:
typedef struct TAGLISTNODE
{
int value;
struct Taglistnode *next;
}listnode;

Required Implementation functions:
void Converse (ListNode **head);
"Input" head: Chain head node, space has been opened up
"Output" head: The node of the linked list head after reverse order
"Back" none

"Note" Only needs to complete the function algorithm, the middle does not need any IO input and output


Returns the new linked header node  linknode *reverse_link (linknode *head)  {      if (head = = null)          return null;      Linknode *prev, *curr, *reverse_head, *temp;      Prev = NULL, Curr = head;      while (Curr->next)      {          temp = curr->next;          Curr->next = prev;          prev = Curr;          Curr = temp;      }      Curr->next = prev;      Reverse_head = Curr;      return reverse_head;  


Huawei Machine Test-Reverse link list output

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.