Problem1793--递增的整数序列链表的插入

1793: 递增的整数序列链表的插入

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 1  Solved: 1
[Submit] [Status] [Web Board] [Creator:]

Description

本题要求实现一个函数,在递增的整数序列链表(带头结点)中插入一个新整数,并保持该序列的有序性。 函数接口定义: List Insert( List L, ElementType X ); 其中List结构定义如下: typedef struct Node *PtrToNode; struct Node { ElementType Data;

Input

L是给定的带头结点的单链表,其结点存储的数据是递增有序的

Output

函数Insert要将X插入L,并保持该序列的有序性,返回插入后的链表头指针。

Sample Input Copy

5
1 2 4 5 6
3

Sample Output Copy

1 2 3 4 5 6

Source/Category

61