Due Date:
Monday, May 27, 2002, at 11:59PM
Points: 100
standard input | standard output |
---|---|
Madam, I'm Adam! | A palindrome |
O give me a home | Not a palindrome |
Able was I ere I saw Elba | A palindrome |
order inode name 1 1119713 . 2 272679 .. 3 1119719 d.c 4 1119738 a.outHint: On the Linux systems in the CSIF, the inode field of the dirent structure is d_ino. Please see the manual pages for the functions for more details. (The inode field is not documented there, but the field containing the name of the file is.)
int insert(struct link **head, int value)
Insert value into the linked list pointed to by *head; update *head if necessary. If the insertion succeeds, return 1; if it fails, return 0.
int delete(struct link **head, int value)
Delete value from the linked list pointed to by *head; update *head if necessary (if the list is empty, make it NULL). If the deletion succeeds, return 1; if it fails (because value is not in the list), return 0.
void prforw(struct link *head)
Print all integers in the linked list pointed to by head in order (from head to tail).
void prback(struct link *head)
Print all integers in the linked list pointed to by head in reverse order (from tail to head).
Unfortunately, they don't quite work right. Debug them. Turn in commented, corrected routines; be sure you mark what changes were made, and why!
Hints: The program testll.c is a program that calls the library routines to manage a linked list of numbers. You can use it to help figure out what the problems are. The manual page on the web tells you how to use that program. Both the file containing the routines, llist.c, and the test program, testll.c, require the header file llist.h.
ECS 30-A, Introduction to Programming Spring Quarter 2002 Email: cs30a@cs.ucdavis.edu |