链表处理
julia7_
keep coding
展开
-
B1025/A1074 反转链表 (25 分)(链表处理)(难)
给定一个常数K以及一个单链表L,请编写程序将L中每K个结点反转。例如:给定L为 1→2→3→4→5→6,K为 3,则输出应该为 3→2→1→6→5→4;如果K为 4,则输出应该为 4→3→2→1→5→6,即最后不到K个元素不反转。输入格式:每个输入包含 1 个测试用例。每个测试用例第 1 行给出第 1 个结点的地址、结点总个数正整数N(≤105)、以及...原创 2019-02-21 14:46:30 · 202 阅读 · 0 评论 -
A1032 Sharing (25 分)(寻找两条链表的第一个共用节点)(链表处理)
To store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may let the words share the same sublist if they share the same suffix. For example,...原创 2019-02-21 15:24:49 · 375 阅读 · 0 评论 -
A1052 Linked List Sorting (25 分)(对链表的data排序输出)
A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integerkeyand aNextpointer to the next structure. Now give...原创 2019-02-21 16:14:08 · 156 阅读 · 0 评论 -
A1097 Deduplication on a Linked List (25 分)(链表处理)
Given a singly linked listLwith integer keys, you are supposed to remove the nodes with duplicated absolute values of the keys. That is, for each valueK, only the first node of which the value or a...原创 2019-02-21 21:19:22 · 249 阅读 · 0 评论
分享