11745 - Add two Linked List   

Description

Writer: jjjjj19980806       Description: pclightyear        Difficulty: ★☆☆☆☆

In this problem, you have to implement 4 functions to add two linked list together.

1. void Create_List(Node**, int);

This function is used to create the linked list according to the input.

2. Node* Add_List(Node*, Node*);

This function is used to create a linked list by adding two linked lists together.

3. void Print_List(Node*);

This function is used to print out the key value in the linked list.

4. void Free_List(Node*);

This function is used to free the memory space.

Input

The input contains two lines of several integers, each line represents a linked list, and each integer represents a node in the linked list.

Each line of input is ended by -1, and you don't need to add a new node with key value -1.

It is guaranteed that:

  • Each key value in the node is an integer between 0 and 100.
  • Each linked list has less than 10 nodes.

Output

You need to output the two original linked lists and the linked list after you add the two original linked lists.

Each key value is separated by "->".

Sample Input  Download

Sample Output  Download

Partial Judge Code

11745.c

Partial Judge Header

11745.h

Tags




Discuss