PAT(甲级)2019年冬季考试 7-2 Block Reversing

2020-12-02
阅读 3 分钟
1.6k
Given a singly linked list L. Let us consider every K nodes as a block (if there are less than K nodes at the end of the list, the rest of the nodes are still considered as a block). Your job is to reverse all the blocks in L. For example, given L as 1→2→3→4→5→6→7→8 and K as 3, your output must b...

PAT_甲级_1133 Splitting A Linked List

2020-11-26
阅读 3 分钟
1.6k
给定一个单链表,节点数目N和阈值K,从新将链表按照如下规则进行排序,节点值小于0的在最左边,[0,K]的在中间,大于K的在最右边,同时同一类别的节点其相对顺序不能改变.