3971: 节点插入(线性表)

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:10 Solved:9

Description

有一个有序单链表(从小到大排序),表头指针为head,编写一个函数向该单链表中插入一个元素为x的结点,使插入后该链表仍然有序。

Input

输入长度n:5

输入数据:1 6 8 9 10

输入插入数据:7

Output

输出:1 6 7 8 9 10

Sample Input Copy

4
1 2 3 4
6

Sample Output Copy

1 2 3 4 6