/* This program uses code from "Algorithms in C, Third Edition," * by Robert Sedgewick, Addison-Wesley, 1998. */ #ifndef LIST_INTERFACE_H #define LIST_INTERFACE_H #include typedef struct node * link; typedef struct struct_list * list; link listFirst(list the_list); link linkNext(link the_link); int linkItem(link the_link); // Creates and returns an empty list. list newList(); // Deallocates memory for all nodes in the list. void destroyList(list the_list); // Creates a new link, that contains the value specified in the argument, // and that points to NULL. */ link newLink(int value); // Inserts new_link to the specified list, at the position right after // the link called "previous". void insertLink(list my_list, link previous, link new_link); /* Inserts new_link to the beginning of the list. */ void insertAtBeginning(list my_list, link new_link); // Deletes the link coming AFTER link x. This function DOES NOT DELETE // link x itself. link deleteNext(list my_list, link x); // Deletes the link at the beginning of the list. link deleteFirst(list my_list); void reverse(list the_list); void printList(list my_list); int listLength(list my_list); void setFirst(list the_list, link first); void setNext(link the_link, link next); list listDeepCopy(list input); // returns a new list that contains all values of input1 and all values // of input2 list mergeLists(list input1, list input2); // modifies target, by inserting to it all links from source. void mergeListsDestructive(list target, list source); #endif /* LIST_INTERFACE_H */