Skip to content

Commit cc7b6ce

Browse files
committed
Classify adjacent operations by name
1 parent 206c104 commit cc7b6ce

File tree

3 files changed

+22
-20
lines changed

3 files changed

+22
-20
lines changed

queue.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ void q_swap(struct list_head *head)
7373
/* Reverse elements in queue */
7474
void q_reverse(struct list_head *head) {}
7575

76+
/* Reverse the nodes of the list k at a time */
77+
void q_reverseK(struct list_head *head, int k)
78+
{
79+
// https://leetcode.com/problems/reverse-nodes-in-k-group/
80+
}
81+
7682
/* Sort elements of queue in ascending order */
7783
void q_sort(struct list_head *head) {}
7884

@@ -83,8 +89,3 @@ int q_descend(struct list_head *head)
8389
// https://leetcode.com/problems/remove-nodes-from-linked-list/description/
8490
return 0;
8591
}
86-
87-
void q_reverseK(struct list_head *head, int k)
88-
{
89-
// https://leetcode.com/problems/reverse-nodes-in-k-group/
90-
}

queue.h

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,21 @@ void q_swap(struct list_head *head);
161161
*/
162162
void q_reverse(struct list_head *head);
163163

164+
/**
165+
* q_reverseK() - Given the head of a linked list, reverse the nodes of the list
166+
* k at a time, and return the modified list.
167+
* @head: header of queue
168+
* @k: is a positive integer and is less than or equal to the length of the
169+
* linked list.
170+
*
171+
* No effect if queue is NULL or empty. If there has only one element, do
172+
* nothing.
173+
*
174+
* Reference:
175+
* https://leetcode.com/problems/reverse-nodes-in-k-group/
176+
*/
177+
void q_reverseK(struct list_head *head, int k);
178+
164179
/**
165180
* q_sort() - Sort elements of queue in ascending order
166181
* @head: header of queue
@@ -185,18 +200,4 @@ void q_sort(struct list_head *head);
185200
*/
186201
int q_descend(struct list_head *head);
187202

188-
/**
189-
* q_reverseK() - Given the head of a linked list, reverse the nodes of the list
190-
* k at a time, and return the modified list.
191-
* @head: header of queue
192-
* @k: is a positive integer and is less than or equal to the length of the
193-
* linked list.
194-
*
195-
* No effect if queue is NULL or empty. If there has only one element, do
196-
* nothing.
197-
*
198-
* Reference:
199-
* https://leetcode.com/problems/reverse-nodes-in-k-group/
200-
*/
201-
void q_reverseK(struct list_head *head, int k);
202203
#endif /* LAB0_QUEUE_H */

scripts/checksums

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
83eab631638b12f2dcd91b1a3e539efee016e305 queue.h
1+
074eed9d04bf8c7de83bab1f7cacf2ea4f9b8ae8 queue.h
22
3337dbccc33eceedda78e36cc118d5a374838ec7 list.h

0 commit comments

Comments
 (0)