/* This program uses code from "Algorithms in C, Third Edition," * by Robert Sedgewick, Addison-Wesley, 1998. */ #ifndef CSE2320_LISTS_H #define CSE2320_LISTS_H typedef struct node * link; typedef struct struct_list * list; link listFirst(list the_list); link linkNext(link the_link); void * 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); // returns 1 if the list is empty, 0 otherwise. int listEmpty(list the_list); // Creates a new link, that contains the value specified in the argument, // and that points to NULL. */ link newLink(void * value); // Creates a new link, that contains the integer specified in the argument, // and that points to NULL. */ link newIntLink(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); /* Inserts new_link to the end of the list. */ void insertAtEnd(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 deleteAtBeginning(list my_list); void reverse(list the_list); // prints the list, assuming it is a list of integers. void printIntList(list my_list); int listLength(list my_list); void setFirst(list the_list, link first); void setNext(link the_link, link next); #endif /* CSE2320_LISTS_H */