说明: 项目任务
在单链表类中增加一个功能erase(x, y), 删除表中所有值在 [x, y] 之间的结点。假设链表中结点数值类型是整形,要求编程返回删除相应结点后的链表长度和链表元素。
输入描述
第一行输入链表List的结点元素值,元素之间用空格间隔,且均为int类型;
第二行输入为x和y,分别表示需要删除结点元素的最小值和最大值。
输出描述
第一行输出删除相应结点后链表的长度;
第二行输出删除相应结点后链表的所有元素,元素之间用空格间隔。若无剩余元素,输出null。(Project tasks
A function erase (x, y) is added to the class of single linked list to delete all nodes whose values are between [x, y]. Assuming that the numerical type of the node in the linked list is plastic, the program is required to return the length and elements of the linked list after deleting the corresponding nodes.
Enter a description
In the first line, enter the node element values of the linked list list, with spaces between the elements, and all of them are of type int;
In the second line, input X and y to indicate the minimum and maximum values of node elements to be deleted.
Output description
The first line outputs the length of the linked list after deleting the corresponding node;
The second line outputs all the elements of the linked list after deleting the corresponding nodes, with space between the elements. If there are no remaining elements, null is output.)