From 6d9fab4c0f52489f2f19a933fa49e29518612736 Mon Sep 17 00:00:00 2001 From: lshprung Date: Tue, 9 Feb 2021 10:02:43 -0800 Subject: Post-class 02/09 --- 02-04.md | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to '02-04.md') diff --git a/02-04.md b/02-04.md index 6f8cf25..96042bb 100644 --- a/02-04.md +++ b/02-04.md @@ -135,17 +135,17 @@ void bag::operator +=(const bag& addend){ ``` //FUNCTIONS for the linked list toolkit -std::size_t list_length(const node *head_ptr); -void list_head_insert(node *& head_ptr, const node::value_type& entry); -void list_insert(node *previous_ptr, const node::value_type& entry); -node *list_search(node *head_ptr, const node::value_type& target); -const node* list_search(const node* head_ptr, const node::value_type& target); -node *list_locate(node *head_ptr, std::size_t position); -const node *list_locate(const node *head_ptr, std::size_t position); -void list_head_remove(node *& head_ptr); -void list_remove(node *previous_ptr); -void list_clear(node *& head_ptr); -void list_copy(const node *source_ptr, node *& head_ptr, node *& tail_ptr); +std::size_t list_length(const node *head_ptr); //length of the list +void list_head_insert(node *& head_ptr, const node::value_type& entry); //insert a new head +void list_insert(node *previous_ptr, const node::value_type& entry); //insert a new node after the given node +node *list_search(node *head_ptr, const node::value_type& target); //search for a value in the list +const node* list_search(const node* head_ptr, const node::value_type& target); //search for a node with a certain value in the list +node *list_locate(node *head_ptr, std::size_t position); //return the nth node in the list +const node *list_locate(const node *head_ptr, std::size_t position); //const version of previous function +void list_head_remove(node *& head_ptr); //remove head pointer (head->next becomes the head) +void list_remove(node *previous_ptr); //remove the pointer after the given pointer +void list_clear(node *& head_ptr); //remove all nodes in list +void list_copy(const node *source_ptr, node *& head_ptr, node *& tail_ptr); //create a copy of a given list ``` ### Parameters for Linked Lists @@ -310,3 +310,7 @@ void list_head_insert(node *& head_ptr, const node::value_type& entry){ - The linked list toolkit also provides for inserting a new node elsewhere - It is easy to remove a node at the front of a list - The linked list toolkit also provides a function for removing a node elsewhere - you should read about this function and the other functions of the toolkit + +--- + +[02/09 ->](02-09.md) -- cgit