From 3a6d7fdfcfe7fe1fa1c09788287e1b005a85a71e Mon Sep 17 00:00:00 2001 From: Blake Romero Date: Mon, 13 Oct 2025 23:21:54 +0100 Subject: Updated list tests & refactored code --- src/lib/list.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/lib/list.h') diff --git a/src/lib/list.h b/src/lib/list.h index 58a7751..11eeee2 100644 --- a/src/lib/list.h +++ b/src/lib/list.h @@ -17,6 +17,12 @@ Node* node_init(int value); void list_print(Node* head); void list_vprint(Node* head); +// Get value at index +int list_get(Node* n, int i); + +// Set value at index +void list_set(Node* n, int index, int value); + // Return number of nodes in list // O(n) int list_length(Node* head); @@ -31,7 +37,7 @@ int list_pop(Node** head); // Append value to the end of the list // O(n) -void list_append(Node* head, int value); +void list_append(Node** head, int value); // Insert a value to the list at index // O(n) @@ -41,10 +47,6 @@ void list_insert(Node** head, int value, int index); // O(n) void list_free(Node** head); -// Remove last node -// O(n) -int list_rmlast(Node** head); - // Remove node at index // O(n) int list_rm(Node** head, int index); -- cgit