| ... | ... | @@ -62,9 +62,9 @@ pub fn SinglyLinkedList(comptime T: type) type { |
| 62 | 62 | return count; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | | /// Invert the list starting from this node in-place. |
| 65 | /// Reverse the list starting from this node in-place. |
| 66 | 66 | /// This operation is O(N). |
| 67 | | pub fn invert(indirect: *?*Node) void { |
| 67 | pub fn reverse(indirect: *?*Node) void { |
| 68 | 68 | if (indirect.* == null) { |
| 69 | 69 | return; |
| 70 | 70 | } |
| ... | ... | @@ -164,7 +164,7 @@ test "basic SinglyLinkedList test" { |
| 164 | 164 | try testing.expect(list.first.?.next.?.data == 4); |
| 165 | 165 | try testing.expect(list.first.?.next.?.next == null); |
| 166 | 166 | |
| 167 | | L.Node.invert(&list.first); |
| 167 | L.Node.reverse(&list.first); |
| 168 | 168 | |
| 169 | 169 | try testing.expect(list.first.?.data == 4); |
| 170 | 170 | try testing.expect(list.first.?.next.?.data == 2); |