#ifndef LIST_H #define LIST_H #include #include // Node typedef struct Node { int value; struct Node* next; } Node; // Create & initialise a new node Node* node_init(int value); // Print linked list values 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); // Prepend a value to the list // O(1) void list_push(Node** head, int value); // Pop (remove) first node // O(1) int list_pop(Node** head); // Append value to the end of the list // O(n) void list_append(Node** head, int value); // Insert a value to the list at index // O(n) void list_insert(Node** head, int value, int index); // Free nodes from memory // O(n) void list_free(Node** head); // Remove node at index // O(n) int list_rm(Node** head, int index); #endif //LIST_H